1
0

files-checker.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Morris Jobke <hey@morrisjobke.de>
  4. *
  5. * @license GNU AGPL version 3 or any later version
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. $expectedFiles = [
  22. '.',
  23. '..',
  24. '.devcontainer',
  25. '.drone.yml',
  26. '.editorconfig',
  27. '.eslintignore',
  28. '.eslintrc.js',
  29. '.git',
  30. '.git-blame-ignore-revs',
  31. '.gitattributes',
  32. '.github',
  33. '.gitignore',
  34. '.gitmodules',
  35. '.htaccess',
  36. '.idea',
  37. '.jshintrc',
  38. '.mailmap',
  39. '.npmignore',
  40. '.php-cs-fixer.dist.php',
  41. '.pre-commit-config.yaml',
  42. '.scrutinizer.yml',
  43. '.tag',
  44. '.tx',
  45. '.user.ini',
  46. '__mocks__',
  47. '__tests__',
  48. '3rdparty',
  49. 'AUTHORS',
  50. 'CHANGELOG.md',
  51. 'CODE_OF_CONDUCT.md',
  52. 'COPYING',
  53. 'COPYING-README',
  54. 'DESIGN.md',
  55. 'Makefile',
  56. 'README.md',
  57. 'SECURITY.md',
  58. 'apps',
  59. 'autotest-checkers.sh',
  60. 'autotest-external.sh',
  61. 'autotest.sh',
  62. 'babel.config.js',
  63. 'build',
  64. 'codecov.yml',
  65. 'composer.json',
  66. 'composer.lock',
  67. 'config',
  68. 'console.php',
  69. 'contribute',
  70. 'core',
  71. 'cron.php',
  72. 'custom.d.ts',
  73. 'cypress.config.ts',
  74. 'cypress.d.ts',
  75. 'cypress',
  76. 'dist',
  77. 'index.html',
  78. 'index.php',
  79. 'jest.config.ts',
  80. 'lib',
  81. 'occ',
  82. 'ocs',
  83. 'ocs-provider',
  84. 'package-lock.json',
  85. 'package.json',
  86. 'psalm-ocp.xml',
  87. 'psalm.xml',
  88. 'public.php',
  89. 'remote.php',
  90. 'resources',
  91. 'robots.txt',
  92. 'status.php',
  93. 'tests',
  94. 'themes',
  95. 'tsconfig.json',
  96. 'vendor-bin',
  97. 'version.php',
  98. 'webpack.common.js',
  99. 'webpack.config.js',
  100. 'webpack.modules.js',
  101. ];
  102. $actualFiles = [];
  103. $files = new \DirectoryIterator(__DIR__ . '/..');
  104. foreach ($files as $file) {
  105. $actualFiles[] = $file->getFilename();
  106. }
  107. $additionalFiles = array_diff($actualFiles, $expectedFiles);
  108. $missingFiles = array_diff($expectedFiles, $actualFiles);
  109. $failed = false;
  110. if (count($additionalFiles) > 0) {
  111. echo sprintf('ERROR: There were %d additional files:', count($additionalFiles)) . PHP_EOL;
  112. echo implode(PHP_EOL, $additionalFiles) . PHP_EOL;
  113. $failed = true;
  114. }
  115. if (count($missingFiles) > 0) {
  116. echo sprintf('ERROR: There were %d missing files:', count($missingFiles)) . PHP_EOL;
  117. echo implode(PHP_EOL, $missingFiles) . PHP_EOL;
  118. $failed = true;
  119. }
  120. if ($failed) {
  121. echo 'ERROR: Please remove or add those files again or inform the release team about those now files to be included or excluded from the release tar ball.' . PHP_EOL;
  122. exit(1);
  123. }
  124. echo 'OK: all expected files are present and no additional files are there.' . PHP_EOL;
  125. exit(0);