1
0

files-checker.php 2.9 KB

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