From b7c87cd40bcafcdd6a788be985e22bae2a9feebe Mon Sep 17 00:00:00 2001 From: colemanw Date: Sat, 6 Jan 2024 10:11:07 -0500 Subject: [PATCH] dev/core#4889 - Exclude tools & tests from deleted-files-list.json --- deleted-files-list.json | 117 +----------------- tools/scripts/generate-deleted-files-list.php | 21 +++- 2 files changed, 23 insertions(+), 115 deletions(-) diff --git a/deleted-files-list.json b/deleted-files-list.json index 38539e7abf..663573909f 100644 --- a/deleted-files-list.json +++ b/deleted-files-list.json @@ -113,7 +113,8 @@ "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/*", @@ -151,8 +152,7 @@ "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/*", @@ -916,117 +916,6 @@ "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/*", diff --git a/tools/scripts/generate-deleted-files-list.php b/tools/scripts/generate-deleted-files-list.php index 5210a7a5af..ddf29ba672 100755 --- a/tools/scripts/generate-deleted-files-list.php +++ b/tools/scripts/generate-deleted-files-list.php @@ -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); -- 2.25.1