Adamw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/109438


Change subject: Rework version stamp code to align with the production method
......................................................................

Rework version stamp code to align with the production method

Change-Id: I2c08a2a19a11a1069952e9f3387e5e629f4c5bfa
---
M .gitignore
M activemq_stomp/activemq_stomp.php
M bin/generate-version
3 files changed, 14 insertions(+), 23 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/38/109438/1

diff --git a/.gitignore b/.gitignore
index cf93179..fc87e52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
 *~
 *.kate-swp
 .*.swp
-version.php
+
+.version-stamp
diff --git a/activemq_stomp/activemq_stomp.php 
b/activemq_stomp/activemq_stomp.php
index b4f31d2..d19131f 100644
--- a/activemq_stomp/activemq_stomp.php
+++ b/activemq_stomp/activemq_stomp.php
@@ -72,13 +72,14 @@
                return true;
        }
 
-       static $version = null;
-       if ( !$version ) {
-               global $donationinterface_version;
-               if ( !empty( $donationinterface_version ) ) {
-                       $version = $donationinterface_version;
+       static $sourceRevision = null;
+       if ( !$sourceRevision ) {
+               $versionStampPath = __DIR__ . "/../.version-stamp";
+               $versionId = file_get_contents( $versionStampPath );
+               if ( $versionId !== false ) ) {
+                       $sourceRevision = $versionId;
                } else {
-                       $version = 'unknown';
+                       $sourceRevision = 'unknown';
                }
        }
 
@@ -92,7 +93,7 @@
                'source_type' => 'payments',
                'source_host' => wfHostname(),
                'source_run_id' => getmypid(),
-               'source_version' => $version,
+               'source_version' => $sourceRevision,
                'source_enqueued_time' => time(),
        );
 
diff --git a/bin/generate-version b/bin/generate-version
index 13824cc..5d25ca3 100755
--- a/bin/generate-version
+++ b/bin/generate-version
@@ -1,21 +1,10 @@
 #!/bin/bash
 #
-# This script should be run manually before deploying to production.  When
-# run with no arguments, it will create a file DonationInterface/version.php,
-# if you wish to store the output elsewhere, pass the file path as argument 1.
+# This script can be run manually, to populate the .version-stamp file.
 #
-# Also, LocalSettings.php must require the generated file.  If the version is
-# not found at runtime, the string "unknown" is used instead.
+# If the version is not found at runtime, the string "unknown" is used instead.
 
-if [ "x$1" == "x" ]; then
-       root_dir="$(dirname $0)/.."
-       dest="$root_dir/version.php"
-else
-       dest="$1"
-fi
+dest="$(dirname $0)/../.version-stamp"
 head_rev=$(git rev-parse --verify HEAD)
 
-cat > $dest <<EOF
-<?php
-\$donationinterface_version = "$head_rev";
-EOF
+echo -n "$head_rev" > $dest

-- 
To view, visit https://gerrit.wikimedia.org/r/109438
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c08a2a19a11a1069952e9f3387e5e629f4c5bfa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to