Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/271145
Change subject: Allow overriding $wgServerName with $wgPageViewInfoDomain
......................................................................
Allow overriding $wgServerName with $wgPageViewInfoDomain
Gets rid of the temporary testing hack for non-Wikimedia wikis
Change-Id: Ia35a910ac15f2115ad8381129909190a57b4cb2d
---
M extension.json
M includes/PageViewInfo.hooks.php
2 files changed, 9 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaPageViewInfo
refs/changes/45/271145/1
diff --git a/extension.json b/extension.json
index 03e521d..e849322 100644
--- a/extension.json
+++ b/extension.json
@@ -30,6 +30,7 @@
"remoteExtPath": "PageViewInfo/resources"
},
"config": {
- "PageViewInfoEndpoint": ""
+ "PageViewInfoEndpoint": "",
+ "PageViewInfoDomain": false
}
}
diff --git a/includes/PageViewInfo.hooks.php b/includes/PageViewInfo.hooks.php
index a27d089..6c8d9d3 100644
--- a/includes/PageViewInfo.hooks.php
+++ b/includes/PageViewInfo.hooks.php
@@ -46,13 +46,16 @@
* @return string
*/
protected static function buildApiUrl( Title $title ) {
- global $wgPageViewInfoEndpoint, $wgServerName;
- // FIXME: temp hack
- $wgServerName = 'en.wikipedia.org';
+ global $wgPageViewInfoEndpoint, $wgPageViewInfoDomain,
$wgServerName;
+ if ( $wgPageViewInfoDomain ) {
+ $serverName = $wgPageViewInfoDomain;
+ } else {
+ $serverName = $wgServerName;
+ }
$encodedTitle = wfUrlencode( $title->getPrefixedDBkey() );
$today = date( 'Ymd' );
$lastMonth = date( 'Ymd', time() - ( 60 * 60 * 24 * 30 ) );
- return "$wgPageViewInfoEndpoint/per-article/$wgServerName"
+ return "$wgPageViewInfoEndpoint/per-article/$serverName"
.
"/all-access/user/$encodedTitle/daily/$lastMonth/$today";
}
--
To view, visit https://gerrit.wikimedia.org/r/271145
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia35a910ac15f2115ad8381129909190a57b4cb2d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaPageViewInfo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits