Jason.ji has uploaded a new change for review.

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

Change subject: Added a config variable $wgWhosOnlineTimeout to set the timeout 
period before WhosOnline decides a user has gone offline. Defaults to the 
original value of 3600 seconds.
......................................................................

Added a config variable $wgWhosOnlineTimeout to set the timeout period before 
WhosOnline decides a user has gone offline. Defaults to the original value of 
3600 seconds.

Change-Id: I2338bd3e06a87cf3ed5d778ee2013b34bc7b1c23
---
M WhosOnline.php
M WhosOnlineSpecialPage.php
M extension.json
3 files changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhosOnline 
refs/changes/27/259527/1

diff --git a/WhosOnline.php b/WhosOnline.php
index d8a8bd5..2f13513 100644
--- a/WhosOnline.php
+++ b/WhosOnline.php
@@ -28,6 +28,9 @@
 // By default, only show usernames rather than user full names.
 $wgWhosOnlineShowRealName = false;
 
+// Timeout before WhosOnline decides a use has gone offline. Default 3600s 
(1h).
+$wgWhosOnlineTimeout = 3600;
+
 $wgMessagesDirs['WhosOnline'] = __DIR__ . '/i18n';
 $wgExtensionMessagesFiles['WhosOnlineAlias'] = __DIR__ . 
'/WhosOnline.alias.php';
 
diff --git a/WhosOnlineSpecialPage.php b/WhosOnlineSpecialPage.php
index 040fec7..a49d5b4 100644
--- a/WhosOnlineSpecialPage.php
+++ b/WhosOnlineSpecialPage.php
@@ -121,10 +121,16 @@
 
        public function execute( $para ) {
                global $wgDBname;
+               global $wgWhosOnlineTimeout;
+
+               $timeout = 3600;
+               if( is_numeric( $wgWhosOnlineTimeout ) ) {
+                       $timeout = $wgWhosOnlineTimeout;
+               }
 
                $db = wfGetDB( DB_MASTER );
                $db->selectDB( $wgDBname );
-               $old = wfTimestamp( TS_MW, time() - 3600 );
+               $old = wfTimestamp( TS_MW, time() - $timeout );
                $db->delete( 'online', array( 'timestamp < "' . $old . '"' ), 
__METHOD__ );
 
                $this->setHeaders();
diff --git a/extension.json b/extension.json
index 46febe1..088db77 100644
--- a/extension.json
+++ b/extension.json
@@ -10,7 +10,8 @@
        "type": "specialpage",
        "config": {
                "WhosOnlineShowAnons": false,
-               "WhosOnlineShowRealName": false
+               "WhosOnlineShowRealName": false,
+               "WhosOnlineTimeout" : 3600
        },
        "MessagesDirs": {
                "WhosOnline": [

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2338bd3e06a87cf3ed5d778ee2013b34bc7b1c23
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhosOnline
Gerrit-Branch: master
Gerrit-Owner: Jason.ji <[email protected]>

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

Reply via email to