set-version.php - Fix autocommit for 'info.xml'
authorTim Otten <totten@civicrm.org>
Thu, 8 Jul 2021 01:48:21 +0000 (18:48 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 8 Jul 2021 02:43:46 +0000 (19:43 -0700)
The 'set-version.php' script has an option `--commit` which should commit any updated files.

Before: Fails to commit changes to `ext/*/info.xml`

After: Does ocmmit changes to `ext/*/info.xml`

tools/bin/scripts/set-version.php

index ef309e2f6a36f5dbff00862bf0e316adfe86cab4..b4be5a31ca28ee8b9cc8cc3e2096f4277cd7fa02 100755 (executable)
@@ -74,7 +74,8 @@ updateFile("sql/test_data_second_domain.mysql", function ($content) use ($newVer
   return str_replace($oldVersion, $newVersion, $content);
 });
 
-foreach (findCoreInfoXml() as $infoXml) {
+$infoXmls = findCoreInfoXml();
+foreach ($infoXmls as $infoXml) {
   updateXmlFile($infoXml, function (DOMDocument $dom) use ($newVersion) {
     foreach ($dom->getElementsByTagName('version') as $tag) {
       /** @var \DOMNode $tag */
@@ -85,7 +86,7 @@ foreach (findCoreInfoXml() as $infoXml) {
 
 if ($doCommit) {
   $files = array_filter(
-    ['xml/version.xml', 'sql/civicrm_generated.mysql', 'sql/test_data_second_domain.mysql', $phpFile, @$sqlFile],
+    array_merge(['xml/version.xml', 'sql/civicrm_generated.mysql', 'sql/test_data_second_domain.mysql', $phpFile, @$sqlFile], $infoXmls),
     'file_exists'
   );
   $filesEsc = implode(' ', array_map('escapeshellarg', $files));