You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

files-checker.php 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. '.codecov.yml',
  25. '.devcontainer',
  26. '.drone.yml',
  27. '.editorconfig',
  28. '.eslintignore',
  29. '.eslintrc.js',
  30. '.git',
  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. '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-js.sh',
  60. 'autotest.sh',
  61. 'babel.config.js',
  62. 'build',
  63. 'composer.json',
  64. 'composer.lock',
  65. 'config',
  66. 'console.php',
  67. 'contribute',
  68. 'core',
  69. 'cron.php',
  70. 'cypress',
  71. 'cypress.config.ts',
  72. 'dist',
  73. 'index.html',
  74. 'index.php',
  75. 'jest.config.js',
  76. 'lib',
  77. 'occ',
  78. 'ocm-provider',
  79. 'ocs',
  80. 'ocs-provider',
  81. 'package-lock.json',
  82. 'package.json',
  83. 'psalm-ocp.xml',
  84. 'psalm.xml',
  85. 'public.php',
  86. 'remote.php',
  87. 'resources',
  88. 'robots.txt',
  89. 'status.php',
  90. 'tests',
  91. 'themes',
  92. 'tsconfig.json',
  93. 'vendor-bin',
  94. 'version.php',
  95. 'webpack.config.js',
  96. 'webpack.modules.js',
  97. ];
  98. $actualFiles = [];
  99. $files = new \DirectoryIterator(__DIR__ . '/..');
  100. foreach ($files as $file) {
  101. $actualFiles[] = $file->getFilename();
  102. }
  103. $additionalFiles = array_diff($actualFiles, $expectedFiles);
  104. $missingFiles = array_diff($expectedFiles, $actualFiles);
  105. $failed = false;
  106. if (count($additionalFiles) > 0) {
  107. echo sprintf('ERROR: There were %d additional files:', count($additionalFiles)) . PHP_EOL;
  108. echo implode(PHP_EOL, $additionalFiles) . PHP_EOL;
  109. $failed = true;
  110. }
  111. if (count($missingFiles) > 0) {
  112. echo sprintf('ERROR: There were %d missing files:', count($missingFiles)) . PHP_EOL;
  113. echo implode(PHP_EOL, $missingFiles) . PHP_EOL;
  114. $failed = true;
  115. }
  116. if ($failed) {
  117. 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;
  118. exit(1);
  119. }
  120. echo 'OK: all expected files are present and no additional files are there.' . PHP_EOL;
  121. exit(0);