1
0

files-checker.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. '.editorconfig',
  26. '.eslintignore',
  27. '.eslintrc.js',
  28. '.git',
  29. '.gitattributes',
  30. '.github',
  31. '.gitignore',
  32. '.gitmodules',
  33. '.htaccess',
  34. '.idea',
  35. '.jshintrc',
  36. '.mailmap',
  37. '.npmignore',
  38. '.php-cs-fixer.dist.php',
  39. '.pre-commit-config.yaml',
  40. '.scrutinizer.yml',
  41. '.tag',
  42. '.tx',
  43. '.user.ini',
  44. '__mocks__',
  45. '__tests__',
  46. '3rdparty',
  47. 'AUTHORS',
  48. 'CHANGELOG.md',
  49. 'CODE_OF_CONDUCT.md',
  50. 'COPYING',
  51. 'COPYING-README',
  52. 'DESIGN.md',
  53. 'Makefile',
  54. 'README.md',
  55. 'SECURITY.md',
  56. 'apps',
  57. 'autotest-checkers.sh',
  58. 'autotest-external.sh',
  59. 'autotest.sh',
  60. 'babel.config.js',
  61. 'build',
  62. 'codecov.yml',
  63. 'composer.json',
  64. 'composer.lock',
  65. 'config',
  66. 'console.php',
  67. 'contribute',
  68. 'core',
  69. 'cron.php',
  70. 'custom.d.ts',
  71. 'cypress.config.ts',
  72. 'cypress.d.ts',
  73. 'cypress',
  74. 'dist',
  75. 'index.html',
  76. 'index.php',
  77. 'jest.config.ts',
  78. 'lib',
  79. 'occ',
  80. 'ocs',
  81. 'ocs-provider',
  82. 'package-lock.json',
  83. 'package.json',
  84. 'psalm-ocp.xml',
  85. 'psalm.xml',
  86. 'public.php',
  87. 'remote.php',
  88. 'resources',
  89. 'robots.txt',
  90. 'status.php',
  91. 'tests',
  92. 'themes',
  93. 'tsconfig.json',
  94. 'vendor-bin',
  95. 'version.php',
  96. 'webpack.common.js',
  97. 'webpack.config.js',
  98. 'webpack.modules.js',
  99. ];
  100. $actualFiles = [];
  101. $files = new \DirectoryIterator(__DIR__ . '/..');
  102. foreach ($files as $file) {
  103. $actualFiles[] = $file->getFilename();
  104. }
  105. $additionalFiles = array_diff($actualFiles, $expectedFiles);
  106. $missingFiles = array_diff($expectedFiles, $actualFiles);
  107. $failed = false;
  108. if (count($additionalFiles) > 0) {
  109. echo sprintf('ERROR: There were %d additional files:', count($additionalFiles)) . PHP_EOL;
  110. echo implode(PHP_EOL, $additionalFiles) . PHP_EOL;
  111. $failed = true;
  112. }
  113. if (count($missingFiles) > 0) {
  114. echo sprintf('ERROR: There were %d missing files:', count($missingFiles)) . PHP_EOL;
  115. echo implode(PHP_EOL, $missingFiles) . PHP_EOL;
  116. $failed = true;
  117. }
  118. if ($failed) {
  119. 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;
  120. exit(1);
  121. }
  122. echo 'OK: all expected files are present and no additional files are there.' . PHP_EOL;
  123. exit(0);