dev/core#4889 - Exclude tools & tests from deleted-files-list.json
authorcolemanw <coleman@civicrm.org>
Sat, 6 Jan 2024 15:11:07 +0000 (10:11 -0500)
committercolemanw <coleman@civicrm.org>
Sat, 6 Jan 2024 15:11:07 +0000 (10:11 -0500)
deleted-files-list.json
tools/scripts/generate-deleted-files-list.php

index 38539e7abf01ee8ad9c73cdb48b39d66bff0097d..663573909f0e446917b74e57664d45011be7c9bc 100644 (file)
     "CRM/Report/Form/Event.php",
     "CRM/Report/Form/Extended.php",
     "CRM/Report/Interface.php",
-    "CRM/Upgrade/3.2.1.msg_template/*",
+    "CRM/Upgrade/3.2.1.msg_template/civicrm_msg_template.tpl",
+    "CRM/Upgrade/3.2.1.msg_template/message_templates/*",
     "CRM/Upgrade/3.2.alpha1.msg_template/*",
     "CRM/Upgrade/3.2.alpha2.msg_template/*",
     "CRM/Upgrade/3.2.alpha3.languages/*",
     "CRM/Upgrade/4.7.11.msg_template/*",
     "CRM/Upgrade/4.7.14.msg_template/*",
     "CRM/Upgrade/4.7.19.msg_template/*",
-    "CRM/Upgrade/4.7.23.msg_template/civicrm_msg_template.tpl",
-    "CRM/Upgrade/4.7.23.msg_template/message_templates/*",
+    "CRM/Upgrade/4.7.23.msg_template/*",
     "CRM/Upgrade/4.7.4.msg_template/*",
     "CRM/Upgrade/4.7.5.msg_template/*",
     "CRM/Upgrade/4.7.alpha1.msg_template/*",
     "templates/CRM/common/navigation.js.tpl",
     "templates/CRM/common/openFlashChart.tpl",
     "templates/CRM/common/wysiwyg.tpl",
-    "tests/README.txt",
-    "tests/fixtures/case.yaml",
-    "tests/fixtures/case_contact.yaml",
-    "tests/fixtures/case_relationships.yaml",
-    "tests/fixtures/case_types.yaml",
-    "tests/fixtures/contacts.yaml",
-    "tests/karma/modules.js",
-    "tests/karma/unit/externalDomainSpec.js",
-    "tests/mock/extension_browser_results/single",
-    "tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php",
-    "tests/phpunit/CRM/Admin/Form/ExtensionTest.php",
-    "tests/phpunit/CRM/Campaign/BAO/CampaignTest.php",
-    "tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php",
-    "tests/phpunit/CRM/Contact/Form/Search/Custom/*",
-    "tests/phpunit/CRM/Contact/Import/Form/data/.~lock.individual_valid_with_related_no_email.csv#",
-    "tests/phpunit/CRM/Contact/Page/View/NoteTest.php",
-    "tests/phpunit/CRM/Contribute/Import/Parser/data/.~lock.contributions.csv#",
-    "tests/phpunit/CRM/Contribute/Import/Parser/data/.~lock.pledge.csv#",
-    "tests/phpunit/CRM/Contribute/Import/Parser/data/contributions.CSV",
-    "tests/phpunit/CRM/Contribute/Import/Parser/data/contributions.txt",
-    "tests/phpunit/CRM/Core/BAO/DashboardTest.php",
-    "tests/phpunit/CRM/Event/Form/RegistrationTest.php",
-    "tests/phpunit/CRM/Event/Form/Task/ParticipantStatusTest.php",
-    "tests/phpunit/CRM/Extension/dataset/good-repository/test.crm.extension.browsertest.a.xml",
-    "tests/phpunit/CRM/Extension/dataset/good-repository/test.crm.extension.browsertest.b.xml",
-    "tests/phpunit/CRM/Member/Form/dataset/*",
-    "tests/phpunit/CRM/Utils/DeprecatedUtilsTest.php",
-    "tests/phpunit/CRM/Utils/GeocodeTest.php",
-    "tests/phpunit/CRMTraits/ACL/*",
-    "tests/phpunit/Civi/Pipe/BasicJsonSessionTest.php",
-    "tests/phpunit/CiviTest/AuthorizeNet.php",
-    "tests/phpunit/CiviTest/CiviSeleniumSettings.auto.php",
-    "tests/phpunit/CiviTest/CiviSeleniumSettings.php.txt",
-    "tests/phpunit/CiviTest/CiviSeleniumTestCase.php",
-    "tests/phpunit/CiviTest/CiviTestDB.php",
-    "tests/phpunit/CiviTest/CiviTestPdoUtils.php",
-    "tests/phpunit/CiviTest/CiviTester.php",
-    "tests/phpunit/CiviTest/Contact.php",
-    "tests/phpunit/CiviTest/ContributionPage.php",
-    "tests/phpunit/CiviTest/Custom.php",
-    "tests/phpunit/CiviTest/Event.php",
-    "tests/phpunit/CiviTest/Membership.php",
-    "tests/phpunit/CiviTest/Participant.php",
-    "tests/phpunit/CiviTest/PaypalPro.php",
-    "tests/phpunit/CiviTest/civicrm.settings.cli.php",
-    "tests/phpunit/CiviTest/civicrm.settings.dist.php",
-    "tests/phpunit/CiviTest/civicrm.settings.local.php.txt",
-    "tests/phpunit/CiviTest/test.hlp",
-    "tests/phpunit/E2E/Extern/SoapTest.php",
-    "tests/phpunit/WebTest/*",
-    "tests/phpunit/api/v3/dataset/email_contact_17.xml",
-    "tests/phpunit/api/v3/dataset/uf_group_test.xml",
-    "tests/phpunit/api/v4/Action/ComplexQueryTest.php",
-    "tests/phpunit/api/v4/DataSets/*",
-    "tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php",
-    "tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php",
-    "tests/phpunit/api/v4/Service/TestCreationParameterProvider.php",
-    "tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php",
-    "tests/phpunit/api/v4/services.xml",
-    "tests/qunit/common-js/*",
-    "tests/templates/documentFunction.tpl",
-    "tools/CRM/*",
-    "tools/bin/scripts/ImportTags.php",
-    "tools/bin/scripts/NormalizePhone.php",
-    "tools/bin/scripts/ajax.php",
-    "tools/bin/scripts/cli.php",
-    "tools/bin/scripts/create-pot-files",
-    "tools/bin/scripts/createdoc.sh",
-    "tools/bin/scripts/delete.sh",
-    "tools/bin/scripts/drop-closing-php-tags.sh",
-    "tools/bin/scripts/ircbot-civi.py",
-    "tools/bin/scripts/memcache.php",
-    "tools/bin/scripts/postIPN.sh",
-    "tools/bin/scripts/replace.sh",
-    "tools/bin/scripts/runCPSTest.sh",
-    "tools/bin/scripts/runStressTest.sh.txt",
-    "tools/bin/scripts/runTest.sh",
-    "tools/bin/scripts/soapClient.php.txt",
-    "tools/bin/scripts/syncPackages.sh",
-    "tools/bin/scripts/testProcess.php",
-    "tools/bin/scripts/test_sandbox.sh",
-    "tools/bin/scripts/updateNameCache.php",
-    "tools/drupal/modules/multicurrency/*",
-    "tools/extensions/org.civicrm.angularex/*",
-    "tools/extensions/org.civicrm.multisite.zip",
-    "tools/extensions/org.civicrm.multisite/*",
-    "tools/extensions/org.civicrm.payment.googlecheckout.zip",
-    "tools/extensions/org.civicrm.payment.googlecheckout/*",
-    "tools/extensions/org.civicrm.report.baykeeper/*",
-    "tools/extensions/org.civicrm.report.grant.zip",
-    "tools/extensions/org.civicrm.report.grant/*",
-    "tools/extensions/org.civicrm.search.activity.zip",
-    "tools/extensions/org.civicrm.search.activity/*",
-    "tools/extensions/org.civicrm.search.basic.zip",
-    "tools/extensions/org.civicrm.search.basic/*",
-    "tools/extensions/org.civicrm.search.multivalue.zip",
-    "tools/extensions/org.civicrm.search.multivalue/*",
-    "tools/extensions/phpstorm/.phpstorm.meta.php",
-    "tools/extensions/phpstorm/mixin/*",
-    "tools/queries",
-    "tools/queriesafter.txt",
-    "tools/scripts/civimail-spooler/*",
-    "tools/scripts/composer/patches/*",
-    "tools/scripts/mk-drupal-test-site",
-    "tools/scripts/releaser/*",
-    "tools/sites/*",
-    "tools/sql/*",
-    "tools/standalone/src/*",
-    "tools/templates/*",
-    "tools/tests/*",
-    "tools/xml/*",
     "vendor/pear/net_smtp/examples/*",
     "vendor/pear/net_smtp/phpdoc.sh",
     "vendor/pear/net_smtp/tests/*",
index 5210a7a5af8e69783948aa69ba674d6b962a24c0..ddf29ba672d6eabf30f10e34ae250f1290da4686 100755 (executable)
@@ -5,13 +5,32 @@ $deletedFiles = [];
 // CRM_Upgrade_Form::MINIMUM_UPGRADABLE_VERSION
 $minVer = '4.6.0';
 
+// Ignore deleted files in these directories.
+// Because this list is primarily for consumption by sites that install
+// from a zip file, tests and tools should not be there anyway.
+$excludeDirectories = [
+  'tests',
+  'tools',
+];
+
 function parseLog($logString, &$deletedFiles, $prefix = '') {
+  global $excludeDirectories;
   $log = preg_split("/\r\n|\n|\r/", $logString);
   foreach ($log as $line) {
     $matches = [];
     preg_match('#delete[ ]+mode[ ]+[0-9]+[ ]+([^ ]+)#', $line, $matches);
     $fileName = $matches[1] ?? NULL;
-    if ($fileName && $fileName !== '1' && !file_exists($prefix . $fileName)) {
+    // No filename or name doesn't make sense
+    if (!$fileName || $fileName === '1') {
+      continue;
+    }
+    // Exclude files from $excludeDirectories
+    foreach ($excludeDirectories as $excludeDirectory) {
+      if (!$prefix && (str_starts_with($fileName, "$excludeDirectory/"))) {
+        continue 2;
+      }
+    }
+    if (!file_exists($prefix . $fileName)) {
       // Was the file deleted or was the entire directory deleted?
       $path = explode('/', $prefix . $fileName);
       array_pop($path);