Commit:    aa1a61c557e93aefdce149f2fba0767e9fe76986
Author:    Sara Golemon <[email protected]>         Tue, 9 Jul 2019 09:41:54 -0400
Parents:   563ed6e547db6b76768e6eb6abcad6c7cec69670
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=aa1a61c557e93aefdce149f2fba0767e9fe76986

Log:
Derive version and release date without global vars

Changed paths:
  M  bin/bumpRelease


Diff:
diff --git a/bin/bumpRelease b/bin/bumpRelease
index f5b1bbb..f11812a 100755
--- a/bin/bumpRelease
+++ b/bin/bumpRelease
@@ -15,17 +15,42 @@ isset($RELEASES[$major]) or die("Unkown major version 
$major");
 
 if (isset($_SERVER['argv'][2])) {
        $minor = intval($_SERVER['argv'][2]);
-       $version_varname = "PHP_{$major}_{$minor}_VERSION";
-       isset($$version_varname) or die("Unknown minor version $major.$minor");
-       $version = $$version_varname;
-       $info = $RELEASES[$major][$version];
+       $version_prefix = "{$major}.{$minor}.";
+       foreach ($RELEASES[$major] as $version => $info) {
+               if (strncmp($version, $version_prefix, strlen($version_prefix)) 
== 0) {
+                       // Bleed $version and $info into outer scope.
+                       break;
+               }
+       }
+       if (strncmp($version, $version_prefix, strlen($version_prefix))) {
+               fwrite(STDERR, "Unknown minor version $major.$minor\n");
+               exit(1);
+       }
 } else {
        // Calling without a minor will just grab the most recent minor.
        $version = key($RELEASES[$major]);
        $info = current($RELEASES[$major]);
 }
 
-$info["date"] = ${"PHP_{$major}_DATE"};
+if (!isset($info['date'])) {
+       // Derive date from source dates.
+       $info['date'] = null;
+       foreach ($info['source'] as $source) {
+               if ($info['date'] === null) {
+                       $info['date'] = $source['date'];
+                       continue;
+               }
+               if ($info['date'] !== $source['date']) {
+                       fwrite(STDERR, "Release has multiple differing dates in 
sources list. Unable to pick one.\n");
+                       exit(1);
+               }
+       }
+       if ($info['date'] === null) {
+               fwrite(STDERR, "Unable to determine release date.\n");
+               exit(1);
+       }
+}
+
 $info["museum"] = false;
 if (is_bool($info["announcement"]) && $info["announcement"]) {
        $info["announcement"] = array("English" => "/releases/" . 
str_replace(".", "_", $version) . ".php");


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to