/** * Show the special page * * @param string $par Parameter passed to the page or null */ public function execute($par) { $out = $this->getOutput(); $this->setHeaders(); $this->outputHeader(); $opts = new FormOptions(); $opts->add('username', ''); $opts->add('hidebots', false, FormOptions::BOOL); $opts->add('hidesysops', false, FormOptions::BOOL); $opts->fetchValuesFromRequest($this->getRequest()); if ($par !== null) { $opts->setValue('username', $par); } // Mention the level of cache staleness... $cacheText = ''; $dbr = wfGetDB(DB_SLAVE, 'recentchanges'); $rcMax = $dbr->selectField('recentchanges', 'MAX(rc_timestamp)', '', __METHOD__); if ($rcMax) { $cTime = $dbr->selectField('querycache_info', 'qci_timestamp', ['qci_type' => 'activeusers'], __METHOD__); if ($cTime) { $secondsOld = wfTimestamp(TS_UNIX, $rcMax) - wfTimestamp(TS_UNIX, $cTime); } else { $rcMin = $dbr->selectField('recentchanges', 'MIN(rc_timestamp)'); $secondsOld = time() - wfTimestamp(TS_UNIX, $rcMin); } if ($secondsOld > 0) { $cacheTxt = '<br>' . $this->msg('cachedspecial-viewing-cached-ttl')->durationParams($secondsOld); } } $pager = new ActiveUsersPager($this->getContext(), $opts); $usersBody = $pager->getBody(); $days = $this->getConfig()->get('ActiveUserDays'); $formDescriptor = ['username' => ['type' => 'user', 'name' => 'username', 'label-message' => 'activeusers-from'], 'hidebots' => ['type' => 'check', 'name' => 'hidebots', 'label-message' => 'activeusers-hidebots', 'default' => false], 'hidesysops' => ['type' => 'check', 'name' => 'hidesysops', 'label-message' => 'activeusers-hidesysops', 'default' => false]]; $htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext())->setIntro($this->msg('activeusers-intro')->numParams($days) . $cacheText)->setWrapperLegendMsg('activeusers')->setSubmitTextMsg('activeusers-submit')->setMethod('get')->prepareForm()->displayForm(false); if ($usersBody) { $out->addHTML($pager->getNavigationBar() . Html::rawElement('ul', [], $usersBody) . $pager->getNavigationBar()); } else { $out->addWikiMsg('activeusers-noresult'); } }
/** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ public function execute($par) { global $wgOut, $wgLang, $wgRCMaxAge; $this->setHeaders(); $up = new ActiveUsersPager(); # getBody() first to check, if empty $usersbody = $up->getBody(); $s = Html::rawElement('div', array('class' => 'mw-activeusers-intro'), wfMsgExt('activeusers-intro', array('parsemag', 'escape'), $wgLang->formatNum(ceil($wgRCMaxAge / 86400)))); $s .= $up->getPageHeader(); if ($usersbody) { $s .= $up->getNavigationBar(); $s .= Html::rawElement('ul', array(), $usersbody); $s .= $up->getNavigationBar(); } else { $s .= Html::element('p', array(), wfMsg('activeusers-noresult')); } $wgOut->addHTML($s); }
/** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ public function execute($par) { global $wgActiveUserDays; $this->setHeaders(); $this->outputHeader(); $out = $this->getOutput(); $out->wrapWikiMsg("<div class='mw-activeusers-intro'>\n\$1\n</div>", array('activeusers-intro', $this->getLanguage()->formatNum($wgActiveUserDays))); $up = new ActiveUsersPager($this->getContext(), null, $par); # getBody() first to check, if empty $usersbody = $up->getBody(); $out->addHTML($up->getPageHeader()); if ($usersbody) { $out->addHTML($up->getNavigationBar() . Html::rawElement('ul', array(), $usersbody) . $up->getNavigationBar()); } else { $out->addWikiMsg('activeusers-noresult'); } }
/** * Show the special page * * @param string $par Parameter passed to the page or null */ public function execute($par) { $days = $this->getConfig()->get('ActiveUserDays'); $this->setHeaders(); $this->outputHeader(); $out = $this->getOutput(); $out->wrapWikiMsg("<div class='mw-activeusers-intro'>\n\$1\n</div>", array('activeusers-intro', $this->getLanguage()->formatNum($days))); // Mention the level of cache staleness... $dbr = wfGetDB(DB_SLAVE, 'recentchanges'); $rcMax = $dbr->selectField('recentchanges', 'MAX(rc_timestamp)', '', __METHOD__); if ($rcMax) { $cTime = $dbr->selectField('querycache_info', 'qci_timestamp', array('qci_type' => 'activeusers'), __METHOD__); if ($cTime) { $secondsOld = wfTimestamp(TS_UNIX, $rcMax) - wfTimestamp(TS_UNIX, $cTime); } else { $rcMin = $dbr->selectField('recentchanges', 'MIN(rc_timestamp)'); $secondsOld = time() - wfTimestamp(TS_UNIX, $rcMin); } if ($secondsOld > 0) { $out->addWikiMsg('cachedspecial-viewing-cached-ttl', $this->getLanguage()->formatDuration($secondsOld)); } } $up = new ActiveUsersPager($this->getContext(), null, $par); # getBody() first to check, if empty $usersbody = $up->getBody(); $out->addHTML($up->getPageHeader()); if ($usersbody) { $out->addHTML($up->getNavigationBar() . Html::rawElement('ul', array(), $usersbody) . $up->getNavigationBar()); } else { $out->addWikiMsg('activeusers-noresult'); } }
/** * Show the special page * * @param string $par Parameter passed to the page or null */ public function execute($par) { $days = $this->getConfig()->get('ActiveUserDays'); $this->setHeaders(); $this->outputHeader(); $out = $this->getOutput(); $out->wrapWikiMsg("<div class='mw-activeusers-intro'>\n\$1\n</div>", array('activeusers-intro', $this->getLanguage()->formatNum($days))); // Occasionally merge in new updates $seconds = min(self::mergeActiveUsers(600, $days), $days * 86400); // Mention the level of staleness $out->addWikiMsg('cachedspecial-viewing-cached-ttl', $this->getLanguage()->formatDuration($seconds)); $up = new ActiveUsersPager($this->getContext(), null, $par); # getBody() first to check, if empty $usersbody = $up->getBody(); $out->addHTML($up->getPageHeader()); if ($usersbody) { $out->addHTML($up->getNavigationBar() . Html::rawElement('ul', array(), $usersbody) . $up->getNavigationBar()); } else { $out->addWikiMsg('activeusers-noresult'); } }