Adamw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/106452
Change subject: (FR #1282) Include source metadata in queue messages
......................................................................
(FR #1282) Include source metadata in queue messages
Change-Id: Icac0c6e8e1d008d9b6d086b23292080b740b4146
---
M Core/DataStores/StompDataStore.php
A Maintenance/generate-version.sh
2 files changed, 35 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig
refs/changes/52/106452/1
diff --git a/Core/DataStores/StompDataStore.php
b/Core/DataStores/StompDataStore.php
index 1dd45a1..01e8a66 100644
--- a/Core/DataStores/StompDataStore.php
+++ b/Core/DataStores/StompDataStore.php
@@ -110,9 +110,23 @@
);
}
+ global $smashpig_version;
+ if (isset($smashpig_version)) {
+ $version = $smashpig_version;
+ } else {
+ $version = "unknown";
+ }
+
$headers = array(
'persistent' => 'true', // So the message
doesn't disappear when the server restarts
'php-message-class' => $objClass, // Sneakyness! No
parameter can have '-' in it's name so this is safe!
+
+ 'source_name' => "SmashPig",
+ 'source_type' => "listener",
+ 'source_host' => gethostname(),
+ 'source_run_id' => getmypid(),
+ 'source_version' => $version,
+ 'source_enqueued_time' => time(),
);
// Populate with custom keys
diff --git a/Maintenance/generate-version.sh b/Maintenance/generate-version.sh
new file mode 100755
index 0000000..cecf864
--- /dev/null
+++ b/Maintenance/generate-version.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# This script should be run manually before deploying to production. When
+# run with no arguments, it will create a file SmashPig/version.php,
+# if you wish to store the output elsewhere, pass the file path as argument 1.
+#
+# Also, config.php must require the generated file. If the version is
+# not found at runtime, the string "unknown" will be used instead.
+
+if [ "x$1" == "x" ]; then
+ root_dir="$(dirname $0)/.."
+ dest="$root_dir/version.php"
+else
+ dest="$1"
+fi
+head_rev=$(git rev-parse --verify HEAD)
+
+cat > $dest <<EOF
+<?php
+\$smashpig_version = "$head_rev";
+EOF
--
To view, visit https://gerrit.wikimedia.org/r/106452
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icac0c6e8e1d008d9b6d086b23292080b740b4146
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits