public function execute($par) { global $wgFlaggedRevsOversightAge; $out = $this->getOutput(); $request = $this->getRequest(); $this->setHeaders(); $this->namespace = $request->getInt('namespace'); $this->level = $request->getIntOrNull('level'); $this->status = $request->getIntOrNull('status'); $this->automatic = $request->getIntOrNull('automatic'); $this->user = $request->getVal('user'); # Check if the user exists $usertitle = Title::makeTitleSafe(NS_USER, $this->user); $u = $usertitle ? User::idFromName($this->user) : false; # Are the dropdown params given even valid? $actions = $this->getActions(); if (empty($actions)) { $out->addWikiMsg('qualityoversight-list', 0); $out->addWikiMsg('logempty'); return; } # Get extra query conds $conds = array('log_namespace' => $this->namespace, 'log_action' => $actions); # Get cutoff time (mainly for performance) if (!$u) { $dbr = wfGetDB(DB_SLAVE); $cutoff_unixtime = time() - $wgFlaggedRevsOversightAge; $cutoff = $dbr->addQuotes($dbr->timestamp($cutoff_unixtime)); $conds[] = "log_timestamp >= {$cutoff}"; } # Create a LogPager item to get the results and a LogEventsList item to format them... $loglist = new LogEventsList($this->getContext()->getSkin(), $out, 0); $pager = new LogPager($loglist, 'review', $this->user, '', '', $conds); # Explanatory text $out->addWikiMsg('qualityoversight-list', $this->getLanguage()->formatNum($pager->getNumRows())); # Show form options $this->showForm(); # Insert list $logBody = $pager->getBody(); if ($logBody) { $out->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar()); } else { $out->addWikiMsg('logempty'); } }
public function getQueryInfo() { $info = parent::getQueryInfo(); $info['fields'][] = 'log_page'; // if Extension:WRArticleType is available if (class_exists('WRArticleType')) { $info['tables'][] = 'page_props'; $info['join_conds']['page_props'] = ['LEFT JOIN', ['pp_page=log_page', 'pp_propname = "ArticleType"']]; $info['fields'][] = 'pp_value'; } return $info; }
function __construct($mode, $tag, $performer = null, $title = '') { # Create a LogPager item to get the results and a LogEventsList item to format them... $loglist = new LogEventsList($this->getContext(), null, 0); /* $extraConds = $this->limitRevTag( $tag ); $extraConds = array_merge( $extraConds, $this->limitByMode( $mode ) ); */ $extraConds = $this->limitByMode($mode); parent::__construct($loglist, array('tag'), $performer, $title, null, $extraConds); }
/** * Gets the relevant HTML for the latest log entry on a given title, including a full log link. * * @param $title Title * @param $types array|string * @return string */ private function getLastLogEntry($title, $types = '') { $lp = new LogPager(new LogEventsList($this->getContext()), $types, '', $title->getPrefixedDbKey()); $lp->mLimit = 1; return $lp->getBody() . Linker::link(SpecialPage::getTitleFor('Log'), $this->msg('log-fulllog')->escaped(), array(), array('page' => $title->getPrefixedDBkey(), 'type' => is_string($types) ? $types : null)); }
/** * Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey) * * @param $out OutputPage|String-by-reference * @param $types String or Array * @param $page String The page title to show log entries for * @param $user String The user who made the log entries * @param $param Associative Array with the following additional options: * - lim Integer Limit of items to show, default is 50 * - conds Array Extra conditions for the query (e.g. "log_action != 'revision'") * - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty * if set to true (default), "No matching items in log" is displayed if loglist is empty * - msgKey Array If you want a nice box with a message, set this to the key of the message. * First element is the message key, additional optional elements are parameters for the key * that are processed with wgMsgExt and option 'parse' * - offset Set to overwrite offset parameter in $wgRequest * set to '' to unset offset * - wrap String Wrap the message in html (usually something like "<div ...>$1</div>"). * - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS) * @return Integer Number of total log items (not limited by $lim) */ public static function showLogExtract(&$out, $types = array(), $page = '', $user = '', $param = array()) { global $wgUser, $wgOut; $defaultParameters = array('lim' => 25, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array(''), 'wrap' => "\$1", 'flags' => 0); # The + operator appends elements of remaining keys from the right # handed array to the left handed, whereas duplicated keys are NOT overwritten. $param += $defaultParameters; # Convert $param array to individual variables $lim = $param['lim']; $conds = $param['conds']; $showIfEmpty = $param['showIfEmpty']; $msgKey = $param['msgKey']; $wrap = $param['wrap']; $flags = $param['flags']; if (!is_array($msgKey)) { $msgKey = array($msgKey); } # Insert list of top 50 (or top $lim) items $loglist = new LogEventsList($wgUser->getSkin(), $wgOut, $flags); $pager = new LogPager($loglist, $types, $user, $page, '', $conds); if (isset($param['offset'])) { # Tell pager to ignore $wgRequest offset $pager->setOffset($param['offset']); } if ($lim > 0) { $pager->mLimit = $lim; } $logBody = $pager->getBody(); $s = ''; if ($logBody) { if ($msgKey[0]) { $s = '<div class="mw-warning-with-logexcerpt">'; if (count($msgKey) == 1) { $s .= wfMsgExt($msgKey[0], array('parse')); } else { // Process additional arguments $args = $msgKey; array_shift($args); $s .= wfMsgExt($msgKey[0], array('parse'), $args); } } $s .= $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList(); } else { if ($showIfEmpty) { $s = Html::rawElement('div', array('class' => 'mw-warning-logempty'), wfMsgExt('logempty', array('parseinline'))); } } if ($pager->getNumRows() > $pager->mLimit) { # Show "Full log" link $urlParam = array(); if ($page != '') { $urlParam['page'] = $page; } if ($user != '') { $urlParam['user'] = $user; } if (!is_array($types)) { # Make it an array, if it isn't $types = array($types); } # If there is exactly one log type, we can link to Special:Log?type=foo if (count($types) == 1) { $urlParam['type'] = $types[0]; } $s .= Linker::link(SpecialPage::getTitleFor('Log'), wfMsgHtml('log-fulllog'), array(), $urlParam); } if ($logBody && $msgKey[0]) { $s .= '</div>'; } if ($wrap != '') { // Wrap message in html $s = str_replace('$1', $s, $wrap); } // $out can be either an OutputPage object or a String-by-reference if ($out instanceof OutputPage) { $out->addHTML($s); } else { $out = $s; } return $pager->getNumRows(); }
/** * Show the set of previous deletions for the page being added. * This function is copied almost exactly from * EditPage::showDeletionLog() - unfortunately, neither that function * nor Article::showDeletionLog() can be called from here, since * they're both protected. */ function showDeletionLog( $out ) { // if MW doesn't have LogEventsList defined, exit immediately if ( ! class_exists( 'LogEventsList' ) ) return false; global $wgUser; $loglist = new LogEventsList( $wgUser->getSkin(), $out ); $pager = new LogPager( $loglist, 'delete', false, $this->mPageTitle->getPrefixedText() ); $count = $pager->getNumRows(); if ( $count > 0 ) { $pager->mLimit = 10; $out->addHTML( '<div class="mw-warning-with-logexcerpt">' ); $out->addWikiMsg( 'moveddeleted-notice' ); $out->addHTML( $loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList() ); if ( $count > 10 ) { $out->addHTML( $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'deletelog-fulllog' ), array(), array( 'type' => 'delete', 'page' => $this->mPageTitle->getPrefixedText() ) ) ); } $out->addHTML( '</div>' ); return true; } return false; }
/** * constructor */ function wfSpecialLog($par = '') { global $wgRequest, $wgOut, $wgUser, $wgLogTypes; # Get parameters $parms = explode('/', $par = $par !== null ? $par : ''); $symsForAll = array('*', 'all'); if ($parms[0] != '' && (in_array($par, $wgLogTypes) || in_array($par, $symsForAll))) { $type = $par; $user = $wgRequest->getText('user'); } else { if (count($parms) == 2) { $type = $parms[0]; $user = $parms[1]; } else { $type = $wgRequest->getVal('type'); $user = $par != '' ? $par : $wgRequest->getText('user'); } } $title = $wgRequest->getText('page'); $pattern = $wgRequest->getBool('pattern'); $y = $wgRequest->getIntOrNull('year'); $m = $wgRequest->getIntOrNull('month'); $tagFilter = $wgRequest->getVal('tagfilter'); # Don't let the user get stuck with a certain date $skip = $wgRequest->getText('offset') || $wgRequest->getText('dir') == 'prev'; if ($skip) { $y = ''; $m = ''; } # Handle type-specific inputs $qc = array(); if ($type == 'suppress') { $offender = User::newFromName($wgRequest->getVal('offender'), false); if ($offender && $offender->getId() > 0) { $qc = array('ls_field' => 'target_author_id', 'ls_value' => $offender->getId()); } else { if ($offender && IP::isIPAddress($offender->getName())) { $qc = array('ls_field' => 'target_author_ip', 'ls_value' => $offender->getName()); } } } # Create a LogPager item to get the results and a LogEventsList item to format them... $loglist = new LogEventsList($wgUser->getSkin(), $wgOut, 0); $pager = new LogPager($loglist, $type, $user, $title, $pattern, $qc, $y, $m, $tagFilter); # Set title and add header $loglist->showHeader($pager->getType()); # Show form options $loglist->showOptions($pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $tagFilter); # Insert list $logBody = $pager->getBody(); if ($logBody) { $wgOut->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar()); } else { $wgOut->addWikiMsg('logempty'); } }
function formatResult($skin, $result) { $title = Title::newFromId($result->id); if (!ApprovedRevs::pageIsApprovable($title)) { return false; } $pageLink = Linker::link($title); if ($this->mMode == 'unapproved') { global $egApprovedRevsShowApproveLatest; $line = $pageLink; if ($egApprovedRevsShowApproveLatest && $title->userCan('approverevisions')) { $line .= ' (' . Xml::element('a', array('href' => $title->getLocalUrl(array('action' => 'approve', 'oldid' => $result->latest_id))), wfMessage('approvedrevs-approvelatest')->text()) . ')'; } return $line; } elseif ($this->mMode == 'notlatest') { $diffLink = Xml::element('a', array('href' => $title->getLocalUrl(array('diff' => $result->latest_id, 'oldid' => $result->rev_id))), wfMessage('approvedrevs-difffromlatest')->text()); return "{$pageLink} ({$diffLink})"; } else { // main mode (pages with an approved revision) global $wgUser, $wgOut, $wgLang; $additionalInfo = Xml::element('span', array('class' => $result->rev_id == $result->latest_id ? 'approvedRevIsLatest' : 'approvedRevNotLatest'), wfMessage('approvedrevs-revisionnumber', $result->rev_id)->text()); // Get data on the most recent approval from the // 'approval' log, and display it if it's there. $loglist = new LogEventsList($wgOut->getSkin(), $wgOut); $pager = new LogPager($loglist, 'approval', '', $title->getText()); $pager->mLimit = 1; $pager->doQuery(); $row = $pager->mResult->fetchObject(); if (!empty($row)) { $timestamp = $wgLang->timeanddate(wfTimestamp(TS_MW, $row->log_timestamp), true); $date = $wgLang->date(wfTimestamp(TS_MW, $row->log_timestamp), true); $time = $wgLang->time(wfTimestamp(TS_MW, $row->log_timestamp), true); $userLink = Linker::userLink($row->log_user, $row->user_name); $additionalInfo .= ', ' . wfMessage('approvedrevs-approvedby', $userLink, $timestamp, $row->user_name, $date, $time)->text(); } return "{$pageLink} ({$additionalInfo})"; } }
/** * If there are rows in the deletion log for this page, show them, * along with a nice little note for the user * * @param OutputPage $out */ protected function showDeletionLog($out) { global $wgUser; $loglist = new LogEventsList($wgUser->getSkin(), $out); $pager = new LogPager($loglist, 'delete', false, $this->mTitle->getPrefixedText()); $count = $pager->getNumRows(); if ($count > 0) { $pager->mLimit = 10; $out->addHTML('<div class="mw-warning-with-logexcerpt">'); $out->addWikiMsg('recreate-deleted-warn'); $out->addHTML($loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList()); if ($count > 10) { $out->addHTML($wgUser->getSkin()->link(SpecialPage::getTitleFor('Log'), wfMsgHtml('deletelog-fulllog'), array(), array('type' => 'delete', 'page' => $this->mTitle->getPrefixedText()))); } $out->addHTML('</div>'); return true; } return false; }
/** * Quick function to show a short log extract * @param $out OutputPage * @param $type String * @param $page String * @param $user String * @param $lim Integer * @param $conds Array */ public static function showLogExtract($out, $type = '', $page = '', $user = '', $lim = 0, $conds = array()) { global $wgUser; # Insert list of top 50 or so items $loglist = new LogEventsList($wgUser->getSkin(), $out, 0); $pager = new LogPager($loglist, $type, $user, $page, '', $conds); if ($lim > 0) { $pager->mLimit = $lim; } $logBody = $pager->getBody(); if ($logBody) { $out->addHTML($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList()); } else { $out->addWikiMsg('logempty'); } return $pager->getNumRows(); }
function formatResult($skin, $result) { $title = Title::makeTitle(NS_FILE, $result->title); if (!self::$repo) { self::$repo = RepoGroup::singleton(); } $pageLink = Linker::link($title); # # Unapproved Files and undesignated Files # if ($this->mMode == 'unapproved' || $this->mMode == 'undesignated') { global $egApprovedRevsShowApproveLatest; $nsApproved = ApprovedRevs::titleInNamespacePermissions($title); $cats = ApprovedRevs::getTitleApprovableCategories($title); $catsApproved = ApprovedRevs::titleInCategoryPermissions($title); $pgApproved = ApprovedRevs::titleInPagePermissions($title); $magicApproved = ApprovedRevs::pageHasMagicWord($title); if ($this->mMode == 'undesignated' && ($nsApproved || $catsApproved || $pgApproved || $magicApproved)) { // if showing undesignated pages only, don't show pages that have real approvability return ''; } if ($egApprovedRevsShowApproveLatest && ApprovedRevs::userCanApprove($title)) { $approveLink = ' (' . Xml::element('a', array('href' => $title->getLocalUrl(array('action' => 'approvefile', 'ts' => $result->latest_ts, 'sha1' => $result->latest_sha1))), wfMessage('approvedrevs-approve')->text()) . ')'; } else { $approveLink = ''; } return "{$pageLink}{$approveLink}"; # # Not Latest Files: # [[My File.jpg]] (revision 2ba82h7f approved; revision 2ba82h7f latest) } elseif ($this->mMode == 'notlatestfiles') { $approved_file = self::$repo->findFileFromKey($result->approved_sha1, array('time' => $result->approved_ts)); $latest_file = self::$repo->findFileFromKey($result->latest_sha1, array('time' => $result->latest_ts)); $approvedLink = Xml::element('a', array('href' => $approved_file->getUrl()), wfMessage('approvedrevs-approvedfile')->text()); $latestLink = Xml::element('a', array('href' => $latest_file->getUrl()), wfMessage('approvedrevs-latestfile')->text()); return "{$pageLink} ({$approvedLink} | {$latestLink})"; # # All Files with an approved revision # } else { // main mode (pages with an approved revision) global $wgUser, $wgOut, $wgLang; $additionalInfo = Xml::element('span', array('class' => $result->approved_sha1 == $result->latest_sha1 && $result->approved_ts == $result->latest_ts ? 'approvedRevIsLatest' : 'approvedRevNotLatest'), wfMessage('approvedrevs-revisionnumber', substr($result->approved_sha1, 0, 8))->parse()); // Get data on the most recent approval from the // 'approval' log, and display it if it's there. $sk = $wgUser->getSkin(); $loglist = new LogEventsList($sk, $wgOut); $pager = new LogPager($loglist, 'approval', '', $title); $pager->mLimit = 1; $pager->doQuery(); $result = $pager->getResult(); $row = $result->fetchObject(); if (!empty($row)) { $timestamp = $wgLang->timeanddate(wfTimestamp(TS_MW, $row->log_timestamp), true); $date = $wgLang->date(wfTimestamp(TS_MW, $row->log_timestamp), true); $time = $wgLang->time(wfTimestamp(TS_MW, $row->log_timestamp), true); $userLink = $sk->userLink($row->log_user, $row->user_name); $additionalInfo .= ', ' . wfMessage('approvedrevs-approvedby', $userLink, $timestamp, $row->user_name, $date, $time)->text(); } return "{$pageLink} ({$additionalInfo})"; } }
/** * If there are rows in the deletion log for this file, show them, * along with a nice little note for the user * * @param OutputPage $out * @param string filename */ private function showDeletionLog($out, $filename) { global $wgUser; $loglist = new LogEventsList($wgUser->getSkin(), $out); $pager = new LogPager($loglist, 'delete', false, $filename); if ($pager->getNumRows() > 0) { $out->addHTML('<div class="mw-warning-with-logexcerpt">'); $out->addWikiMsg('upload-wasdeleted'); $out->addHTML($loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList()); $out->addHTML('</div>'); } }
private function show(FormOptions $opts, array $extraConds) { # Create a LogPager item to get the results and a LogEventsList item to format them... $loglist = new LogEventsList($this->getContext(), null, LogEventsList::USE_REVDEL_CHECKBOXES); $pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter')); $this->addHeader($opts->getValue('type')); # Set relevant user if ($pager->getPerformer()) { $this->getSkin()->setRelevantUser(User::newFromName($pager->getPerformer())); } # Show form options $loglist->showOptions($pager->getType(), $opts->getValue('user'), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter')); # Reuben, upgrade 1.23: apply a special hack where we insert FORCE INDEX (times) # into the sql query, because Mysql chooses the wrong index and the Database # class has a bug where it generates sql with syntax errors. if (!$pager->getType() && !$opts->getValue('user') && !$pager->getPage()) { $pager->setIndexHack(); } # Insert list $logBody = $pager->getBody(); if ($logBody) { $this->getOutput()->addHTML($pager->getNavigationBar() . $this->getRevisionButton($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList()) . $pager->getNavigationBar()); } else { $this->getOutput()->addWikiMsg('logempty'); } }
/** * Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey) * * @param OutputPage|string $out By-reference * @param string|array $types Log types to show * @param string|Title $page The page title to show log entries for * @param string $user The user who made the log entries * @param array $param Associative Array with the following additional options: * - lim Integer Limit of items to show, default is 50 * - conds Array Extra conditions for the query (e.g. "log_action != 'revision'") * - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty * if set to true (default), "No matching items in log" is displayed if loglist is empty * - msgKey Array If you want a nice box with a message, set this to the key of the message. * First element is the message key, additional optional elements are parameters for the key * that are processed with wfMessage * - offset Set to overwrite offset parameter in WebRequest * set to '' to unset offset * - wrap String Wrap the message in html (usually something like "<div ...>$1</div>"). * - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS) * - useRequestParams boolean Set true to use Pager-related parameters in the WebRequest * - useMaster boolean Use master DB * @return int Number of total log items (not limited by $lim) */ public static function showLogExtract(&$out, $types = array(), $page = '', $user = '', $param = array()) { $defaultParameters = array('lim' => 25, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array(''), 'wrap' => "\$1", 'flags' => 0, 'useRequestParams' => false, 'useMaster' => false); # The + operator appends elements of remaining keys from the right # handed array to the left handed, whereas duplicated keys are NOT overwritten. $param += $defaultParameters; # Convert $param array to individual variables $lim = $param['lim']; $conds = $param['conds']; $showIfEmpty = $param['showIfEmpty']; $msgKey = $param['msgKey']; $wrap = $param['wrap']; $flags = $param['flags']; $useRequestParams = $param['useRequestParams']; if (!is_array($msgKey)) { $msgKey = array($msgKey); } if ($out instanceof OutputPage) { $context = $out->getContext(); } else { $context = RequestContext::getMain(); } # Insert list of top 50 (or top $lim) items $loglist = new LogEventsList($context, null, $flags); $pager = new LogPager($loglist, $types, $user, $page, '', $conds); if (!$useRequestParams) { # Reset vars that may have been taken from the request $pager->mLimit = 50; $pager->mDefaultLimit = 50; $pager->mOffset = ""; $pager->mIsBackwards = false; } if ($param['useMaster']) { $pager->mDb = wfGetDB(DB_MASTER); } if (isset($param['offset'])) { # Tell pager to ignore WebRequest offset $pager->setOffset($param['offset']); } if ($lim > 0) { $pager->mLimit = $lim; } // Fetch the log rows and build the HTML if needed $logBody = $pager->getBody(); $numRows = $pager->getNumRows(); $s = ''; if ($logBody) { if ($msgKey[0]) { $dir = $context->getLanguage()->getDir(); $lang = $context->getLanguage()->getHtmlCode(); $s = Xml::openElement('div', array('class' => "mw-warning-with-logexcerpt mw-content-{$dir}", 'dir' => $dir, 'lang' => $lang)); if (count($msgKey) == 1) { $s .= $context->msg($msgKey[0])->parseAsBlock(); } else { // Process additional arguments $args = $msgKey; array_shift($args); $s .= $context->msg($msgKey[0], $args)->parseAsBlock(); } } $s .= $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList(); } elseif ($showIfEmpty) { $s = Html::rawElement('div', array('class' => 'mw-warning-logempty'), $context->msg('logempty')->parse()); } if ($numRows > $pager->mLimit) { # Show "Full log" link $urlParam = array(); if ($page instanceof Title) { $urlParam['page'] = $page->getPrefixedDBkey(); } elseif ($page != '') { $urlParam['page'] = $page; } if ($user != '') { $urlParam['user'] = $user; } if (!is_array($types)) { # Make it an array, if it isn't $types = array($types); } # If there is exactly one log type, we can link to Special:Log?type=foo if (count($types) == 1) { $urlParam['type'] = $types[0]; } $s .= Linker::link(SpecialPage::getTitleFor('Log'), $context->msg('log-fulllog')->escaped(), array(), $urlParam); } if ($logBody && $msgKey[0]) { $s .= '</div>'; } if ($wrap != '') { // Wrap message in html $s = str_replace('$1', $s, $wrap); } /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */ if (Hooks::run('LogEventsListShowLogExtract', array(&$s, $types, $page, $user, $param))) { // $out can be either an OutputPage object or a String-by-reference if ($out instanceof OutputPage) { $out->addHTML($s); } else { $out = $s; } } return $numRows; }
private function show(FormOptions $opts, array $extraConds) { # Create a LogPager item to get the results and a LogEventsList item to format them... $loglist = new LogEventsList($this->getContext(), null, LogEventsList::USE_REVDEL_CHECKBOXES); $pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter')); $this->addHeader($opts->getValue('type')); # Set relevant user if ($pager->getPerformer()) { $this->getSkin()->setRelevantUser(User::newFromName($pager->getPerformer())); } # Show form options $loglist->showOptions($pager->getType(), $opts->getValue('user'), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter')); # Insert list $logBody = $pager->getBody(); if ($logBody) { $this->getOutput()->addHTML($pager->getNavigationBar() . $this->getRevisionButton($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList()) . $pager->getNavigationBar()); } else { $this->getOutput()->addWikiMsg('logempty'); } }
private function show(FormOptions $opts, array $extraConds) { global $wgOut; # Create a LogPager item to get the results and a LogEventsList item to format them... $loglist = new LogEventsList($this->getSkin(), $wgOut, 0); $pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter')); # Set title and add header $loglist->showHeader($pager->getType()); # Set relevant user if ($pager->getUser()) { $this->getSkin()->setRelevantUser(User::newFromName($pager->getUser())); } # Show form options $loglist->showOptions($pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter')); # Insert list $logBody = $pager->getBody(); if ($logBody) { $wgOut->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar()); } else { $wgOut->addWikiMsg('logempty'); } }
/** * Show the set of previous deletions for the page being edited. */ function showDeletionLog($out) { // if MW doesn't have LogEventsList defined, exit immediately if (!class_exists('LogEventsList')) { return false; } // MW 1.18+ ? if (method_exists('LogEventsList', 'showLogExtract')) { LogEventsList::showLogExtract($out, 'delete', $this->mPageTitle->getPrefixedText(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice'))); return true; } // Old code, that can be removed once compatibility for // MW 1.17 goes away (or maybe it can be removed already). // This code was copied almost exactly from the method // EditPage::showDeletionLog(), which no longer exists. global $wgUser; $loglist = new LogEventsList($wgUser->getSkin(), $out); $pager = new LogPager($loglist, 'delete', false, $this->mPageTitle->getPrefixedText()); $count = $pager->getNumRows(); if ($count > 0) { $pager->mLimit = 10; $out->addHTML('<div class="mw-warning-with-logexcerpt">'); $out->addWikiMsg('moveddeleted-notice'); $out->addHTML($loglist->beginLogEventsList() . $pager->getBody() . $loglist->endLogEventsList()); if ($count > 10) { $out->addHTML($wgUser->getSkin()->link(SpecialPage::getTitleFor('Log'), wfMessage('deletelog-fulllog')->escaped(), array(), array('type' => 'delete', 'page' => $this->mPageTitle->getPrefixedText()))); } $out->addHTML('</div>'); return true; } return false; }