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.6KB

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