jenkins-bot has submitted this change and it was merged.

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, 14 insertions(+), 5 deletions(-)

Approvals:
  Jack Phoenix: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/WhosOnline.php b/WhosOnline.php
index d8a8bd5..11f0607 100644
--- a/WhosOnline.php
+++ b/WhosOnline.php
@@ -15,7 +15,7 @@
 $wgExtensionCredits['specialpage'][] = array(
        'path' => __FILE__,
        'name' => 'WhosOnline',
-       'version' => '1.6.0',
+       'version' => '1.7.0',
        'author' => 'Maciej Brencz',
        'descriptionmsg' => 'whosonline-desc',
        'url' => 'https://www.mediawiki.org/wiki/Extension:WhosOnline',
@@ -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..910bd58 100644
--- a/WhosOnlineSpecialPage.php
+++ b/WhosOnlineSpecialPage.php
@@ -120,11 +120,16 @@
        }
 
        public function execute( $para ) {
-               global $wgDBname;
+               global $wgDBname, $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..63276f6 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
        "name": "WhosOnline",
-       "version": "1.6.0",
+       "version": "1.7.0",
        "author": [
                "Maciej Brencz"
        ],
@@ -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: merged
Gerrit-Change-Id: I2338bd3e06a87cf3ed5d778ee2013b34bc7b1c23
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/WhosOnline
Gerrit-Branch: master
Gerrit-Owner: Jason.ji <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Jason.ji <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to