MarkAHershberger has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/350105 )
Change subject: Add hook for on output page
......................................................................
Add hook for on output page
Change-Id: I37e028c07be7ef1ae78848e3a382d5270d1625e1
---
M WhoIsWatching_body.php
1 file changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching
refs/changes/05/350105/1
diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index a87e585..5f24910 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -236,4 +236,31 @@
return true;
}
+
+ public static function onSkinTemplateOutputPageBeforeExec( Skin
$template, QuickTemplate $tpl ) {
+ $conf = new GlobalVarConfig( "whoiswatching_" );
+ $showIfZero = $conf->get( "showifzero" );
+ $showWatchingUsers = $conf->get( "showwatchingusers" );
+
+ if (
+
RequestContext::getMain()->getOutput()->getTitle()->getNamespace() >= 0 &&
+ $showWatchingUsers
+ ) {
+ $dbr = wfGetDB( DB_SLAVE );
+ $title = $template->getTitle();
+ $res = $dbr->select( 'watchlist', 'COUNT(*) as count', [
+ 'wl_namespace'
=> $title->getNamespace(),
+ 'wl_title' =>
$title->getDBkey(),
+ ], __METHOD__ );
+ $watch = $dbr->fetchObject( $res );
+ if ( $watch->count > 0 || $showIfZero ) {
+ $msg = wfMessage(
'whoiswatching_users_pageview',
+
RequestContext::getMain()->getLanguage()->formatNum( $watch->count )
+ )->parse();
+ $tpl->set( 'numberofwatchingusers', $msg );
+ }
+ }
+
+ return true;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/350105
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37e028c07be7ef1ae78848e3a382d5270d1625e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits