set-version.php - Fix for running on uninitialized codebase
authorCiviCRM <info@civicrm.org>
Thu, 15 Mar 2018 23:06:29 +0000 (23:06 +0000)
committerCiviCRM <info@civicrm.org>
Thu, 15 Mar 2018 23:06:29 +0000 (23:06 +0000)
The script assumes that `civicrm-version.php` is around. It will eventually be
committed, and it's available if you ran GenCode, but it's not *necessarily*
around yet.

tools/bin/scripts/set-version.php

index e20f4a7fa96b016ac9b11c4c096729f01e3222a3..711c196483c3f8ba97646c41506223b93f612a40 100755 (executable)
@@ -61,9 +61,11 @@ updateFile("xml/version.xml", function ($content) use ($newVersion, $oldVersion)
   return str_replace($oldVersion, $newVersion, $content);
 });
 
-updateFile("civicrm-version.php", function ($content) use ($newVersion, $oldVersion) {
-  return str_replace($oldVersion, $newVersion, $content);
-});
+if (file_exists("civicrm-version.php")) {
+  updateFile("civicrm-version.php", function ($content) use ($newVersion, $oldVersion) {
+    return str_replace($oldVersion, $newVersion, $content);
+  });
+}
 
 updateFile("sql/civicrm_generated.mysql", function ($content) use ($newVersion, $oldVersion) {
   return str_replace($oldVersion, $newVersion, $content);