r35241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35240‎ | r35241 | r35242 >
Date:18:57, 23 May 2008
Author:aaron
Status:old
Tags:
Comment:
Move out auxillary special pages
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/DepreciationOversight_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php (added) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -221,34 +221,34 @@
222222 # Load review UI
223223 $wgSpecialPages['RevisionReview'] = 'RevisionReview';
224224 $wgAutoloadClasses['RevisionReview'] = $dir . 'FlaggedRevsPage.php';
 225+
225226 # Load stableversions UI
226227 $wgSpecialPages['StableVersions'] = 'StableVersions';
227 -$wgAutoloadClasses['StableVersions'] = $dir . 'FlaggedRevsPage.php';
 228+$wgAutoloadClasses['StableVersions'] = $dir . '/specialpages/StableVersions_body.php';
228229 # Stable version config
229230 $wgSpecialPages['Stabilization'] = 'Stabilization';
230 -$wgAutoloadClasses['Stabilization'] = $dir . 'FlaggedRevsPage.php';
231 -
 231+$wgAutoloadClasses['Stabilization'] = $dir . '/specialpages/Stabilization_body.php';
232232 # Load unreviewed pages list
233233 $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages';
234 -$wgAutoloadClasses['UnreviewedPages'] = $dir . 'FlaggedRevsPage.php';
 234+$wgAutoloadClasses['UnreviewedPages'] = $dir . '/specialpages/UnreviewedPages_body.php';
235235 # Load "in need of re-review" pages list
236236 $wgSpecialPages['OldReviewedPages'] = 'OldReviewedPages';
237 -$wgAutoloadClasses['OldReviewedPages'] = $dir . 'FlaggedRevsPage.php';
 237+$wgAutoloadClasses['OldReviewedPages'] = $dir . '/specialpages/OldReviewedPages_body.php';
238238 # Load reviewed pages list
239239 $wgSpecialPages['ReviewedPages'] = 'ReviewedPages';
240 -$wgAutoloadClasses['ReviewedPages'] = $dir . 'FlaggedRevsPage.php';
 240+$wgAutoloadClasses['ReviewedPages'] = $dir . '/specialpages/ReviewedPages_body.php';
241241 $wgSpecialPageGroups['ReviewedPages'] = 'quality';
242242 # Load stable pages list
243243 $wgSpecialPages['StablePages'] = 'StablePages';
244 -$wgAutoloadClasses['StablePages'] = $dir . 'FlaggedRevsPage.php';
 244+$wgAutoloadClasses['StablePages'] = $dir . '/specialpages/StablePages_body.php';
245245 $wgSpecialPageGroups['StablePages'] = 'quality';
246246 # To oversee quality revisions
247247 $wgSpecialPages['QualityOversight'] = 'QualityOversight';
248 -$wgAutoloadClasses['QualityOversight'] = $dir . 'FlaggedRevsPage.php';
 248+$wgAutoloadClasses['QualityOversight'] = $dir . '/specialpages/QualityOversight_body.php';
249249 $wgSpecialPageGroups['QualityOversight'] = 'quality';
250250 # To oversee depreciations
251251 $wgSpecialPages['DepreciationOversight'] = 'DepreciationOversight';
252 -$wgAutoloadClasses['DepreciationOversight'] = $dir . 'FlaggedRevsPage.php';
 252+$wgAutoloadClasses['DepreciationOversight'] = $dir . '/specialpages/DepreciationOversight_body.php';
253253 $wgSpecialPageGroups['DepreciationOversight'] = 'quality';
254254
255255 ######### Hook attachments #########
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -0,0 +1,270 @@
 2+<?php
 3+
 4+class Stabilization extends UnlistedSpecialPage
 5+{
 6+ function __construct() {
 7+ UnlistedSpecialPage::UnlistedSpecialPage( 'Stabilization', 'stablesettings' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgRequest, $wgUser, $wgOut;
 12+
 13+ $confirm = $wgRequest->wasPosted() &&
 14+ $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
 15+
 16+ $this->isAllowed = $wgUser->isAllowed( 'stablesettings' );
 17+ # Let anyone view, but not submit...
 18+ if( $wgRequest->wasPosted() ) {
 19+ if( $wgUser->isBlocked( !$confirm ) ) {
 20+ $wgOut->blockedPage();
 21+ return;
 22+ } else if( !$this->isAllowed ) {
 23+ $wgOut->permissionRequired( 'stablesettings' );
 24+ return;
 25+ } else if( wfReadOnly() ) {
 26+ $wgOut->readOnlyPage();
 27+ return;
 28+ }
 29+ }
 30+
 31+ $this->setHeaders();
 32+ $this->skin = $wgUser->getSkin();
 33+
 34+ $isValid = true;
 35+ # Our target page
 36+ $this->target = $wgRequest->getText( 'page' );
 37+ $this->page = Title::newFromUrl( $this->target );
 38+ # We need a page...
 39+ if( is_null($this->page) ) {
 40+ $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 41+ return;
 42+ } else if( !$this->page->exists() ) {
 43+ $wgOut->addHTML( wfMsgExt( 'stabilization-notexists', array('parseinline'), $this->page->getPrefixedText() ) );
 44+ return;
 45+ } else if( !FlaggedRevs::isPageReviewable( $this->page ) ) {
 46+ $wgOut->addHTML( wfMsgExt( 'stabilization-notcontent', array('parseinline'), $this->page->getPrefixedText() ) );
 47+ return;
 48+ }
 49+
 50+ # Watch checkbox
 51+ $this->watchThis = $wgRequest->getCheck( 'wpWatchthis' );
 52+ # Reason
 53+ $this->comment = $wgRequest->getVal( 'wpReason' );
 54+ # Get visiblity settings...
 55+ $config = FlaggedRevs::getPageVisibilitySettings( $this->page, true );
 56+ $this->select = $config['select'];
 57+ $this->override = $config['override'];
 58+ $this->expiry = $config['expiry'] !== 'infinity' ? wfTimestamp( TS_RFC2822, $config['expiry'] ) : 'infinite';
 59+ if( $wgRequest->wasPosted() ) {
 60+ $this->select = $wgRequest->getInt( 'mwStableconfig-select' );
 61+ $this->override = intval( $wgRequest->getBool( 'mwStableconfig-override' ) );
 62+ $this->expiry = $wgRequest->getText( 'mwStableconfig-expiry' );
 63+ if( strlen( $this->expiry ) == 0 ) {
 64+ $this->expiry = 'infinite';
 65+ }
 66+ if( $this->select && !in_array( $this->select, array(FLAGGED_VIS_NORMAL,FLAGGED_VIS_LATEST) ) ) {
 67+ $isValid = false;
 68+ }
 69+ }
 70+
 71+ if( $isValid && $confirm ) {
 72+ $this->submit();
 73+ } else {
 74+ $this->showSettings();
 75+ }
 76+ }
 77+
 78+ function showSettings( $err = null ) {
 79+ global $wgOut, $wgTitle, $wgUser;
 80+
 81+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
 82+ # Must be a content page
 83+ if( !FlaggedRevs::isPageReviewable( $this->page ) ) {
 84+ $wgOut->addHTML( wfMsgExt('stableversions-none', array('parse'), $this->page->getPrefixedText() ) );
 85+ return;
 86+ }
 87+
 88+ if ( "" != $err ) {
 89+ $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
 90+ $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
 91+ }
 92+
 93+ if( !$this->isAllowed ) {
 94+ $form = wfMsgExt( 'stabilization-perm', array('parse'), $this->page->getPrefixedText() );
 95+ $off = array('disabled' => 'disabled');
 96+ } else {
 97+ $form = wfMsgExt( 'stabilization-text', array('parse'), $this->page->getPrefixedText() );
 98+ $off = array();
 99+ }
 100+
 101+ $special = SpecialPage::getTitleFor( 'Stabilization' );
 102+ $form .= Xml::openElement( 'form', array( 'name' => 'stabilization', 'action' => $special->getLocalUrl( ), 'method' => 'post' ) );
 103+
 104+ $form .= "<fieldset><legend>".wfMsg('stabilization-def')."</legend>";
 105+ $form .= "<table><tr>";
 106+ $form .= "<td>".Xml::radio( 'mwStableconfig-override', 1, (1==$this->override), array('id' => 'default-stable')+$off)."</td>";
 107+ $form .= "<td>".Xml::label( wfMsg('stabilization-def1'), 'default-stable' )."</td>";
 108+ $form .= "</tr><tr>";
 109+ $form .= "<td>".Xml::radio( 'mwStableconfig-override', 0, (0==$this->override), array('id' => 'default-current')+$off)."</td>";
 110+ $form .= "<td>".Xml::label( wfMsg('stabilization-def2'), 'default-current' )."</td>";
 111+ $form .= "</tr></table></fieldset>";
 112+
 113+ $form .= "<fieldset><legend>".wfMsg('stabilization-select')."</legend>";
 114+ $form .= "<table><tr>";
 115+ /*
 116+ $form .= "<td>".Xml::radio( 'mwStableconfig-select', FLAGGED_VIS_PRISTINE,
 117+ (FLAGGED_VIS_PRISTINE==$this->select), array('id' => 'stable-select3')+$off )."</td>";
 118+ $form .= "<td>".Xml::label( wfMsg('stabilization-select3'), 'stable-select3' )."</td>";
 119+ $form .= "</tr><tr>";
 120+ */
 121+ $form .= "<td>".Xml::radio( 'mwStableconfig-select', FLAGGED_VIS_NORMAL,
 122+ (FLAGGED_VIS_NORMAL==$this->select), array('id' => 'stable-select1')+$off )."</td>";
 123+ $form .= "<td>".Xml::label( wfMsg('stabilization-select1'), 'stable-select1' )."</td>";
 124+ $form .= "</tr><tr>";
 125+ $form .= "<td>".Xml::radio( 'mwStableconfig-select', FLAGGED_VIS_LATEST,
 126+ (FLAGGED_VIS_LATEST==$this->select), array('id' => 'stable-select2')+$off )."</td>";
 127+ $form .= "<td>".Xml::label( wfMsg('stabilization-select2'), 'stable-select2' )."</td>";
 128+ $form .= "</tr></table></fieldset>";
 129+
 130+ if( $this->isAllowed ) {
 131+ $form .= "<fieldset><legend>".wfMsgHtml('stabilization-leg')."</legend>";
 132+ $form .= '<table>';
 133+ $form .= '<tr><td>'.Xml::label( wfMsg('stabilization-comment'), 'wpReason' ).'</td>';
 134+ $form .= '<td>'.Xml::input( 'wpReason', 60, $this->comment, array('id' => 'wpReason') )."</td></tr>";
 135+ } else {
 136+ $form .= '<table>';
 137+ }
 138+ $form .= '<tr>';
 139+ $form .= '<td><label for="expires">' . wfMsgExt( 'stabilization-expiry', array( 'parseinline' ) ) . '</label></td>';
 140+ $form .= '<td>' . Xml::input( 'mwStableconfig-expiry', 60, $this->expiry, array('id' => 'expires')+$off ) . '</td>';
 141+ $form .= '</tr>';
 142+ $form .= '</table>';
 143+
 144+ if( $this->isAllowed ) {
 145+ $watchLabel = wfMsgExt('watchthis', array('parseinline'));
 146+ $watchAttribs = array('accesskey' => wfMsg( 'accesskey-watch' ), 'id' => 'wpWatchthis');
 147+ $watchChecked = ( $wgUser->getOption( 'watchdefault' ) || $wgTitle->userIsWatching() );
 148+
 149+ $form .= "<p>&nbsp;&nbsp;&nbsp;".Xml::check( 'wpWatchthis', $watchChecked, $watchAttribs );
 150+ $form .= "&nbsp;<label for='wpWatchthis'".$this->skin->tooltipAndAccesskey('watch').">{$watchLabel}</label></p>";
 151+
 152+ $form .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
 153+ $form .= Xml::hidden( 'page', $this->page->getPrefixedText() );
 154+ $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() );
 155+
 156+ $form .= '<p>'.Xml::submitButton( wfMsg( 'stabilization-submit' ) ).'</p>';
 157+ $form .= "</fieldset>";
 158+ }
 159+
 160+ $form .= '</form>';
 161+
 162+ $wgOut->addHTML( $form );
 163+
 164+ $wgOut->addHtml( Xml::element( 'h2', NULL, htmlspecialchars( LogPage::logName( 'stable' ) ) ) );
 165+ $logViewer = new LogViewer(
 166+ new LogReader( new FauxRequest(
 167+ array( 'page' => $this->page->getPrefixedText(), 'type' => 'stable' ) ) ) );
 168+ $logViewer->showList( $wgOut );
 169+ }
 170+
 171+ function submit() {
 172+ global $wgOut, $wgUser, $wgParser, $wgFlaggedRevsOverride, $wgFlaggedRevsPrecedence;
 173+
 174+ $changed = $reset = false;
 175+ # Take this opportunity to purge out expired configurations
 176+ FlaggedRevs::purgeExpiredConfigurations();
 177+
 178+ if( $this->expiry == 'infinite' || $this->expiry == 'indefinite' ) {
 179+ $expiry = Block::infinity();
 180+ } else {
 181+ # Convert GNU-style date, on error returns -1 for PHP <5.1 and false for PHP >=5.1
 182+ $expiry = strtotime( $this->expiry );
 183+
 184+ if( $expiry < 0 || $expiry === false ) {
 185+ $this->showSettings( wfMsg( 'stabilize_expiry_invalid' ) );
 186+ return false;
 187+ }
 188+
 189+ $expiry = wfTimestamp( TS_MW, $expiry );
 190+
 191+ if ( $expiry < wfTimestampNow() ) {
 192+ $this->showSettings( wfMsg( 'stabilize_expiry_old' ) );
 193+ return false;
 194+ }
 195+ }
 196+
 197+ $dbw = wfGetDB( DB_MASTER );
 198+ # Get current config
 199+ $row = $dbw->selectRow( 'flaggedpage_config',
 200+ array( 'fpc_select', 'fpc_override', 'fpc_expiry' ),
 201+ array( 'fpc_page_id' => $this->page->getArticleID() ),
 202+ __METHOD__ );
 203+ # If setting to site default values, erase the row if there is one...
 204+ if( $row && $this->select != $wgFlaggedRevsPrecedence && $this->override == $wgFlaggedRevsOverride ) {
 205+ $reset = true;
 206+ $dbw->delete( 'flaggedpage_config',
 207+ array( 'fpc_page_id' => $this->page->getArticleID() ),
 208+ __METHOD__ );
 209+ $changed = ($dbw->affectedRows() != 0); // did this do anything?
 210+ # Otherwise, add a row unless we are just setting it as the site default, or it is the same the current one...
 211+ } else if( $this->select !=0 || $this->override !=$wgFlaggedRevsOverride ) {
 212+ if( $row->fpc_select != $this->select || $row->fpc_override != $this->override || $row->fpc_expiry !== $expiry ) {
 213+ $changed = true;
 214+ $dbw->replace( 'flaggedpage_config',
 215+ array( 'PRIMARY' ),
 216+ array( 'fpc_page_id' => $this->page->getArticleID(),
 217+ 'fpc_select' => $this->select,
 218+ 'fpc_override' => $this->override,
 219+ 'fpc_expiry' => $expiry ),
 220+ __METHOD__ );
 221+ }
 222+ }
 223+
 224+ # Log if changed
 225+ # @FIXME: do this better
 226+ if( $changed ) {
 227+ global $wgContLang;
 228+
 229+ $log = new LogPage( 'stable' );
 230+ # ID, accuracy, depth, style
 231+ $set = array();
 232+ $set[] = wfMsg( "stabilization-sel-short" ) . ": " .
 233+ wfMsg("stabilization-sel-short-{$this->select}");
 234+ $set[] = wfMsg( "stabilization-def-short" ) . ": " .
 235+ wfMsg("stabilization-def-short-{$this->override}");
 236+ $settings = '[' . implode(', ',$set). ']';
 237+
 238+ $comment = '';
 239+ # Append comment with settings (other than for resets)
 240+ if( !$reset ) {
 241+ $comment = $this->comment ? "{$this->comment} $settings" : "$settings";
 242+
 243+ $encodedExpiry = Block::encodeExpiry($expiry, $dbw );
 244+ if( $encodedExpiry != 'infinity' ) {
 245+ $expiry_description = ' (' . wfMsgForContent( 'stabilize-expiring',
 246+ $wgContLang->timeanddate($expiry, false, false) ) . ')';
 247+ $comment .= "$expiry_description";
 248+ }
 249+ }
 250+
 251+ if( $reset ) {
 252+ $log->addEntry( 'reset', $this->page, $comment );
 253+ } else {
 254+ $log->addEntry( 'config', $this->page, $comment );
 255+ }
 256+ }
 257+
 258+ # Update the links tables as the stable version may now be the default page...
 259+ FlaggedRevs::titleLinksUpdate( $this->page );
 260+
 261+ if( $this->watchThis ) {
 262+ $wgUser->addWatch( $this->page );
 263+ } else {
 264+ $wgUser->removeWatch( $this->page );
 265+ }
 266+
 267+ $wgOut->redirect( $this->page->getFullUrl() );
 268+
 269+ return true;
 270+ }
 271+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
___________________________________________________________________
Added: svn:eol-style
1272 + native
Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
@@ -0,0 +1,184 @@
 2+<?php
 3+
 4+class UnreviewedPages extends SpecialPage
 5+{
 6+ function __construct() {
 7+ SpecialPage::SpecialPage( 'UnreviewedPages', 'unreviewedpages' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgRequest, $wgUser, $wgOut;
 12+ $this->setHeaders();
 13+ if( !$wgUser->isAllowed( 'unreviewedpages' ) ) {
 14+ $wgOut->permissionRequired( 'unreviewedpages' );
 15+ return;
 16+ }
 17+ $this->skin = $wgUser->getSkin();
 18+ $this->showList( $wgRequest );
 19+ }
 20+
 21+ function showList( $wgRequest ) {
 22+ global $wgOut, $wgScript, $wgTitle, $wgFlaggedRevsNamespaces;
 23+ # If no NS given, then just use the first of $wgFlaggedRevsNamespaces
 24+ $defaultNS = empty($wgFlaggedRevsNamespaces) ? 0 : $wgFlaggedRevsNamespaces[0];
 25+ $namespace = $wgRequest->getIntOrNull( 'namespace', $defaultNS );
 26+ $category = trim( $wgRequest->getVal( 'category' ) );
 27+
 28+ $action = htmlspecialchars( $wgScript );
 29+ $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
 30+ '<fieldset><legend>' . wfMsg('unreviewed-legend') . '</legend>' .
 31+ Xml::hidden( 'title', $wgTitle->getPrefixedText() ) . '<p>' );
 32+ if( count($wgFlaggedRevsNamespaces) > 1 ) {
 33+ $wgOut->addHTML( Xml::label( wfMsg("namespace"), 'namespace' ) .
 34+ FlaggedRevsXML::getNamespaceMenu( $namespace ) ) . '&nbsp;';
 35+ }
 36+ $wgOut->addHTML( Xml::label( wfMsg("unreviewed-category"), 'category' ) .
 37+ ' ' . Xml::input( 'category', 35, $category, array('id' => 'category') ) .
 38+ '&nbsp;&nbsp;' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
 39+ "</fieldset></form>"
 40+ );
 41+ # This will start to get slower...
 42+ if( $category || self::generalQueryOK() ) {
 43+ $pager = new UnreviewedPagesPager( $this, $namespace, $category );
 44+ if( $pager->getNumRows() ) {
 45+ $wgOut->addHTML( wfMsgExt('unreviewed-list', array('parse') ) );
 46+ $wgOut->addHTML( $pager->getNavigationBar() );
 47+ $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
 48+ $wgOut->addHTML( $pager->getNavigationBar() );
 49+ } else {
 50+ $wgOut->addHTML( wfMsgExt('unreviewed-none', array('parse') ) );
 51+ }
 52+ }
 53+ }
 54+
 55+ function formatRow( $result ) {
 56+ global $wgLang, $wgUser;
 57+
 58+ $title = Title::makeTitle( $result->page_namespace, $result->page_title );
 59+ $link = $this->skin->makeKnownLinkObj( $title );
 60+ $css = $stxt = $review = '';
 61+ if( !is_null($size = $result->page_len) ) {
 62+ global $wgLang;
 63+ $stxt = ($size == 0) ?
 64+ wfMsgHtml('historyempty') : wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
 65+ $stxt = " <small>$stxt</small>";
 66+ }
 67+ if( $wgUser->isAllowed('unwatchedpages') ) {
 68+ $uw = self::usersWatching( $title );
 69+ $watching = $uw ? wfMsgExt("unreviewed-watched",array('parsemag'),$uw,$uw) : wfMsgHtml("unreviewed-unwatched");
 70+ $watching = " $watching";
 71+ // Oh-noes!
 72+ $css = $uw ? "" : " class='fr-unreviewed-unwatched'";
 73+ } else {
 74+ $watching = "";
 75+ }
 76+
 77+ return( "<li{$css}>{$link} {$stxt} {$review}{$watching}</li>" );
 78+ }
 79+
 80+ /**
 81+ * Get number of users watching a page. Max is 5.
 82+ * @param Title $title
 83+ */
 84+ public static function usersWatching( $title ) {
 85+ global $wgMiserMode;
 86+ $dbr = wfGetDB( DB_SLAVE );
 87+ if( $wgMiserMode ) {
 88+ # Get a rough idea of size
 89+ $count = $dbr->estimateRowCount( 'watchlist', '*',
 90+ array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
 91+ __METHOD__ );
 92+ # If it is small, just COUNT() it, otherwise, stick with estimate...
 93+ if( $count <= 10 ) {
 94+ $count = $dbr->selectField( 'watchlist', 'COUNT(*)',
 95+ array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
 96+ __METHOD__ );
 97+ }
 98+ } else {
 99+ $count = $dbr->selectField( 'watchlist', 'COUNT(*)',
 100+ array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
 101+ __METHOD__ );
 102+ }
 103+ return $count;
 104+ }
 105+
 106+ /**
 107+ * There may be many pages, most of which are reviewed
 108+ */
 109+ public static function generalQueryOK() {
 110+ global $wgFlaggedRevsNamespaces;
 111+ if( !wfQueriesMustScale() )
 112+ return true;
 113+ # Get est. of fraction of pages that are reviewed
 114+ $dbr = wfGetDB( DB_SLAVE );
 115+ $reviewedpages = $dbr->estimateRowCount( 'flaggedpages', '*', array(), __METHOD__ );
 116+ $pages = $dbr->estimateRowCount( 'page', '*', array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ );
 117+ $ratio = $pages/($pages - $reviewedpages);
 118+ # If dist. is normalized, # of rows scanned = $ratio * LIMIT (or until list runs out)
 119+ return ($ratio <= 200);
 120+ }
 121+}
 122+
 123+/**
 124+ * Query to list out unreviewed pages
 125+ */
 126+class UnreviewedPagesPager extends AlphabeticPager {
 127+ public $mForm, $mConds;
 128+ private $namespace, $category;
 129+
 130+ function __construct( $form, $namespace, $category=NULL, $conds = array() ) {
 131+ $this->mForm = $form;
 132+ $this->mConds = $conds;
 133+ # Must be a content page...
 134+ global $wgFlaggedRevsNamespaces;
 135+ if( !is_null($namespace) ) {
 136+ $namespace = intval($namespace);
 137+ }
 138+ if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
 139+ $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 140+ }
 141+ $this->namespace = $namespace;
 142+ $this->category = $category ? str_replace(' ','_',$category) : NULL;
 143+
 144+ parent::__construct();
 145+ }
 146+
 147+ function formatRow( $row ) {
 148+ return $this->mForm->formatRow( $row );
 149+ }
 150+
 151+ function getQueryInfo() {
 152+ $conds = $this->mConds;
 153+ $fields = array('page_namespace','page_title','page_len','fp_stable');
 154+ $conds[] = 'fp_reviewed IS NULL';
 155+ # Reviewable pages only
 156+ $conds['page_namespace'] = $this->namespace;
 157+ # No redirects
 158+ $conds['page_is_redirect'] = 0;
 159+ # Filter by category
 160+ if( $this->category ) {
 161+ $tables = array( 'categorylinks', 'page', 'flaggedpages' );
 162+ $fields[] = 'cl_sortkey';
 163+ $conds['cl_to'] = $this->category;
 164+ $conds[] = 'cl_from = page_id';
 165+ $this->mIndexField = 'cl_sortkey';
 166+ $useIndex = array( 'categorylinks' => 'cl_sortkey' );
 167+ } else {
 168+ $tables = array( 'page', 'flaggedpages' );
 169+ $fields[] = 'page_id';
 170+ $this->mIndexField = 'page_title';
 171+ $useIndex = array( 'page' => 'name_title' );
 172+ }
 173+ return array(
 174+ 'tables' => $tables,
 175+ 'fields' => $fields,
 176+ 'conds' => $conds,
 177+ 'options' => array( 'USE INDEX' => $useIndex ),
 178+ 'join_conds' => array( 'flaggedpages' => array('LEFT JOIN','fp_page_id=page_id') )
 179+ );
 180+ }
 181+
 182+ function getIndexField() {
 183+ return $this->mIndexField;
 184+ }
 185+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
___________________________________________________________________
Added: svn:eol-style
1186 + native
Index: trunk/extensions/FlaggedRevs/specialpages/DepreciationOversight_body.php
@@ -0,0 +1,33 @@
 2+<?php
 3+
 4+class DepreciationOversight extends SpecialPage
 5+{
 6+ function __construct() {
 7+ SpecialPage::SpecialPage( 'DepreciationOversight' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgOut, $wgUser, $wgFlaggedRevsOversightAge;
 12+ $this->setHeaders();
 13+ $wgOut->addHTML( wfMsgExt('depreciationoversight-list', array('parse') ) );
 14+ # Create a LogPager item to get the results and a LogEventsList item to format them...
 15+ $dbr = wfGetDB( DB_SLAVE );
 16+ $cutoff = $dbr->addQuotes( $dbr->timestamp(time() - $wgFlaggedRevsOversightAge) );
 17+ $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
 18+ $pager = new LogPager( $loglist, 'review', '', '', '',
 19+ array('log_action' => array('unapprove','unapprove2'), "log_timestamp > $cutoff" ) );
 20+ # Insert list
 21+ $logBody = $pager->getBody();
 22+ if( $logBody ) {
 23+ $wgOut->addHTML(
 24+ $pager->getNavigationBar() .
 25+ $loglist->beginLogEventsList() .
 26+ $logBody .
 27+ $loglist->endLogEventsList() .
 28+ $pager->getNavigationBar()
 29+ );
 30+ } else {
 31+ $wgOut->addWikiMsg( 'logempty' );
 32+ }
 33+ }
 34+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/DepreciationOversight_body.php
___________________________________________________________________
Added: svn:eol-style
135 + native
Index: trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php
@@ -0,0 +1,33 @@
 2+<?php
 3+
 4+class QualityOversight extends SpecialPage
 5+{
 6+ function __construct() {
 7+ SpecialPage::SpecialPage( 'QualityOversight' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgOut, $wgUser, $wgFlaggedRevsOversightAge;
 12+ $this->setHeaders();
 13+ $wgOut->addHTML( wfMsgExt('qualityoversight-list', array('parse') ) );
 14+ # Create a LogPager item to get the results and a LogEventsList item to format them...
 15+ $dbr = wfGetDB( DB_SLAVE );
 16+ $cutoff = $dbr->addQuotes( $dbr->timestamp(time() - $wgFlaggedRevsOversightAge) );
 17+ $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
 18+ $pager = new LogPager( $loglist, 'review', '', '', '',
 19+ array('log_action' => array('approve2','unapprove2'), "log_timestamp > $cutoff" ) );
 20+ # Insert list
 21+ $logBody = $pager->getBody();
 22+ if( $logBody ) {
 23+ $wgOut->addHTML(
 24+ $pager->getNavigationBar() .
 25+ $loglist->beginLogEventsList() .
 26+ $logBody .
 27+ $loglist->endLogEventsList() .
 28+ $pager->getNavigationBar()
 29+ );
 30+ } else {
 31+ $wgOut->addWikiMsg( 'logempty' );
 32+ }
 33+ }
 34+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php
___________________________________________________________________
Added: svn:eol-style
135 + native
Index: trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php
@@ -0,0 +1,109 @@
 2+<?php
 3+
 4+class StableVersions extends UnlistedSpecialPage
 5+{
 6+ function __construct() {
 7+ UnlistedSpecialPage::UnlistedSpecialPage( 'StableVersions' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgRequest, $wgUser, $wgOut;
 12+
 13+ $this->setHeaders();
 14+ $this->skin = $wgUser->getSkin();
 15+ # Our target page
 16+ $this->target = $wgRequest->getText( 'page' );
 17+ $this->page = Title::newFromUrl( $this->target );
 18+ # Revision ID
 19+ $this->oldid = $wgRequest->getVal( 'oldid' );
 20+ $this->oldid = ($this->oldid=='best') ? 'best' : intval($this->oldid);
 21+ # We need a page...
 22+ if( is_null($this->page) ) {
 23+ $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 24+ return;
 25+ }
 26+
 27+ $this->showStableList();
 28+ }
 29+
 30+ function showStableList() {
 31+ global $wgOut, $wgUser;
 32+ # Must be a content page
 33+ if( !FlaggedRevs::isPageReviewable( $this->page ) ) {
 34+ $wgOut->addHTML( wfMsgExt('stableversions-none', array('parse'),
 35+ $this->page->getPrefixedText() ) );
 36+ return;
 37+ }
 38+ $pager = new StableRevisionsPager( $this, array(), $this->page );
 39+ if( $pager->getNumRows() ) {
 40+ $wgOut->addHTML( wfMsgExt('stableversions-list', array('parse'),
 41+ $this->page->getPrefixedText() ) );
 42+ $wgOut->addHTML( $pager->getNavigationBar() );
 43+ $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
 44+ $wgOut->addHTML( $pager->getNavigationBar() );
 45+ } else {
 46+ $wgOut->addHTML( wfMsgExt('stableversions-none', array('parse'),
 47+ $this->page->getPrefixedText() ) );
 48+ }
 49+ }
 50+
 51+ function formatRow( $row ) {
 52+ global $wgLang, $wgUser;
 53+
 54+ $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->rev_timestamp), true );
 55+ $ftime = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->fr_timestamp), true );
 56+ $review = wfMsg( 'stableversions-review', $ftime,
 57+ $this->skin->userLink( $row->fr_user, $row->user_name ) .
 58+ ' ' . $this->skin->userToolLinks( $row->fr_user, $row->user_name ) );
 59+
 60+ $lev = ( $row->fr_quality >=1 ) ? wfMsg('hist-quality') : wfMsg('hist-stable');
 61+ $link = $this->skin->makeKnownLinkObj( $this->page, $time,
 62+ 'stableid='.$row->fr_rev_id );
 63+
 64+ return '<li>'.$link.' ('.$review.') <strong>['.$lev.']</strong></li>';
 65+ }
 66+}
 67+
 68+/**
 69+ * Query to list out stable versions for a page
 70+ */
 71+class StableRevisionsPager extends ReverseChronologicalPager {
 72+ public $mForm, $mConds;
 73+
 74+ function __construct( $form, $conds = array(), $title ) {
 75+ $this->mForm = $form;
 76+ $this->mConds = $conds;
 77+ $this->namespace = $title->getNamespace();
 78+ $this->pageID = $title->getArticleID();
 79+
 80+ parent::__construct();
 81+ }
 82+
 83+ function formatRow( $row ) {
 84+ return $this->mForm->formatRow( $row );
 85+ }
 86+
 87+ function getQueryInfo() {
 88+ global $wgFlaggedRevsNamespaces;
 89+
 90+ $conds = $this->mConds;
 91+ # Must be in a reviewable namespace
 92+ if( !in_array($this->namespace, $wgFlaggedRevsNamespaces) ) {
 93+ $conds[] = "1 = 0";
 94+ }
 95+ $conds["fr_page_id"] = $this->pageID;
 96+ $conds[] = "fr_rev_id = rev_id";
 97+ $conds[] = "fr_user = user_id";
 98+ $conds[] = 'rev_deleted & '.Revision::DELETED_TEXT.' = 0';
 99+ return array(
 100+ 'tables' => array('flaggedrevs','revision','user'),
 101+ 'fields' => 'fr_rev_id,fr_timestamp,rev_timestamp,fr_quality,fr_user,user_name',
 102+ 'conds' => $conds,
 103+ 'options' => array( 'USE INDEX' => array('flaggedrevs' => 'PRIMARY') )
 104+ );
 105+ }
 106+
 107+ function getIndexField() {
 108+ return 'fr_rev_id';
 109+ }
 110+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php
___________________________________________________________________
Added: svn:eol-style
1111 + native
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -0,0 +1,149 @@
 2+<?php
 3+
 4+class OldReviewedPages extends SpecialPage
 5+{
 6+ function __construct() {
 7+ SpecialPage::SpecialPage( 'OldReviewedPages', 'unreviewedpages' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgRequest, $wgUser, $wgOut;
 12+ $this->setHeaders();
 13+ if( !$wgUser->isAllowed( 'unreviewedpages' ) ) {
 14+ $wgOut->permissionRequired( 'unreviewedpages' );
 15+ return;
 16+ }
 17+ $this->skin = $wgUser->getSkin();
 18+ $this->showList( $wgRequest );
 19+ }
 20+
 21+ function showList( $wgRequest ) {
 22+ global $wgOut, $wgScript, $wgTitle, $wgFlaggedRevsNamespaces;
 23+
 24+ $namespace = $wgRequest->getIntOrNull( 'namespace' );
 25+ $category = trim( $wgRequest->getVal( 'category' ) );
 26+
 27+ $action = htmlspecialchars( $wgScript );
 28+
 29+ $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
 30+ '<fieldset><legend>' . wfMsg('oldreviewedpages-legend') . '</legend>');
 31+ if( count($wgFlaggedRevsNamespaces) > 1 ) {
 32+ $wgOut->addHTML( Xml::label( wfMsg("namespace"), 'namespace' ) .
 33+ FlaggedRevsXML::getNamespaceMenu( $namespace ) . '&nbsp;' );
 34+ }
 35+ $wgOut->addHTML( Xml::hidden( 'title', $wgTitle->getPrefixedText() ) .
 36+ Xml::label( wfMsg("unreviewed-category"), 'category' ) .
 37+ ' ' . Xml::input( 'category', 35, $category, array('id' => 'category') ) .
 38+ '&nbsp;&nbsp;' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
 39+ "</fieldset></form>" );
 40+
 41+ $pager = new OldReviewedPagesPager( $this, $namespace, $category );
 42+ if( $pager->getNumRows() ) {
 43+ $wgOut->addHTML( wfMsgExt('oldreviewedpages-list', array('parse') ) );
 44+ $wgOut->addHTML( $pager->getNavigationBar() );
 45+ $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
 46+ $wgOut->addHTML( $pager->getNavigationBar() );
 47+ } else {
 48+ $wgOut->addHTML( wfMsgExt('oldreviewedpages-none', array('parse') ) );
 49+ }
 50+ }
 51+
 52+ function formatRow( $result ) {
 53+ global $wgLang, $wgFlaggedRevsLongPending;
 54+
 55+ $title = Title::makeTitle( $result->page_namespace, $result->page_title );
 56+ $link = $this->skin->makeKnownLinkObj( $title );
 57+ $css = $stxt = $review = '';
 58+ if( !is_null($size = $result->page_len) ) {
 59+ $stxt = ($size == 0) ?
 60+ wfMsgHtml('historyempty') : wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
 61+ $stxt = " <small>$stxt</small>";
 62+ }
 63+ $review = $this->skin->makeKnownLinkObj( $title, wfMsg('unreviewed-diff'),
 64+ "diff=cur&oldid={$result->fp_stable}" );
 65+ $quality = $result->fp_quality ? wfMsgHtml('oldreviewedpages-quality') : wfMsgHtml('oldreviewedpages-stable');
 66+ # Get how long the first unreviewed edit has been waiting...
 67+ $firstPending = $title->getNextRevisionID($result->fp_stable);
 68+ if( $firstPendingTime = Revision::getTimestampFromID($firstPending) ) {
 69+ $currentTime = wfTimestamp( TS_UNIX ); // now
 70+ $firstPendingTime = wfTimestamp( TS_UNIX, $firstPendingTime );
 71+ $hours = ($currentTime - $firstPendingTime)/3600;
 72+ // After three days, just use days
 73+ if( $hours > (3*24) ) {
 74+ $days = round($hours/24,0);
 75+ $age = wfMsgExt('oldreviewedpages-days',array('parsemag'),$days);
 76+ // If one or more hours, use hours
 77+ } else if( $hours >= 1 ) {
 78+ $hours = round($hours,0);
 79+ $age = wfMsgExt('oldreviewedpages-hours',array('parsemag'),$hours);
 80+ } else {
 81+ $age = wfMsg('oldreviewedpages-recent'); // hot of the press :)
 82+ }
 83+ // Oh-noes!
 84+ $css = ($hours > $wgFlaggedRevsLongPending) ? " class='fr-pending-long'" : "";
 85+ } else {
 86+ $age = ""; // wtf?
 87+ }
 88+ # Is anybody watching?
 89+ $uw = UnreviewedPages::usersWatching( $title );
 90+ $watching = $uw ? wfMsgExt("unreviewed-watched",array('parsemag'),$uw,$uw) : wfMsgHtml("unreviewed-unwatched");
 91+
 92+ return( "<li{$css}>{$link} {$stxt} ({$review}) <i>{$age}</i> <strong>[{$quality}]</strong> {$watching}</li>" );
 93+ }
 94+}
 95+
 96+/**
 97+ * Query to list out unreviewed pages
 98+ */
 99+class OldReviewedPagesPager extends AlphabeticPager {
 100+ public $mForm, $mConds;
 101+ private $category, $namespace;
 102+
 103+ function __construct( $form, $namespace, $category=NULL, $conds = array() ) {
 104+ $this->mForm = $form;
 105+ $this->mConds = $conds;
 106+ # Must be a content page...
 107+ global $wgFlaggedRevsNamespaces;
 108+ if( !is_null($namespace) ) {
 109+ $namespace = intval($namespace);
 110+ }
 111+ if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
 112+ $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 113+ }
 114+ $this->namespace = $namespace;
 115+ $this->category = $category ? str_replace(' ','_',$category) : NULL;
 116+
 117+ parent::__construct();
 118+ }
 119+
 120+ function formatRow( $row ) {
 121+ return $this->mForm->formatRow( $row );
 122+ }
 123+
 124+ function getQueryInfo() {
 125+ $conds = $this->mConds;
 126+ $tables = array( 'flaggedpages', 'page' );
 127+ $fields = array('page_namespace','page_title','page_len','fp_stable','fp_quality','fp_page_id');
 128+ $conds['fp_reviewed'] = 0;
 129+ $conds[] = 'page_id = fp_page_id';
 130+ $conds['page_namespace'] = $this->namespace;
 131+ $useIndex = array('flaggedpages' => 'fp_reviewed_page','page' => 'PRIMARY');
 132+ # Filter by category
 133+ if( $this->category ) {
 134+ $tables[] = 'categorylinks';
 135+ $conds[] = 'cl_from = page_id';
 136+ $conds['cl_to'] = $this->category;
 137+ $useIndex['categorylinks'] = 'cl_from';
 138+ }
 139+ return array(
 140+ 'tables' => $tables,
 141+ 'fields' => $fields,
 142+ 'conds' => $conds,
 143+ 'options' => array( 'USE INDEX' => $useIndex )
 144+ );
 145+ }
 146+
 147+ function getIndexField() {
 148+ return 'fp_page_id';
 149+ }
 150+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
___________________________________________________________________
Added: svn:eol-style
1151 + native
Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
@@ -0,0 +1,126 @@
 2+<?php
 3+
 4+class ReviewedPages extends SpecialPage
 5+{
 6+ function __construct() {
 7+ SpecialPage::SpecialPage( 'ReviewedPages' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgRequest, $wgUser, $wgFlaggedRevValues, $wgFlaggedRevPristine;
 12+
 13+ $this->setHeaders();
 14+ $this->skin = $wgUser->getSkin();
 15+
 16+ # Check if there is a featured level
 17+ $maxType = FlaggedRevs::pristineVersions() ? 2 : 1;
 18+ $this->namespace = $wgRequest->getInt( 'namespace' );
 19+ $this->type = $wgRequest->getInt( 'level' );
 20+ $this->type = $this->type <= $maxType ? $this->type : 0;
 21+
 22+ $this->showForm();
 23+ $this->showPageList();
 24+ }
 25+
 26+ function showForm() {
 27+ global $wgOut, $wgTitle, $wgScript, $wgFlaggedRevsNamespaces;
 28+
 29+ $form = Xml::openElement( 'form',
 30+ array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) );
 31+ $form .= "<fieldset><legend>".wfMsg('reviewedpages-leg')."</legend>\n";
 32+
 33+ if( count($wgFlaggedRevsNamespaces) > 1 ) {
 34+ $form .= Xml::label( wfMsg("namespace"), 'namespace' ) .
 35+ FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
 36+ }
 37+ $form .= FlaggedRevsXML::getLevelMenu( $this->type );
 38+
 39+ $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
 40+ $form .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
 41+ $form .= "</fieldset></form>\n";
 42+
 43+ $wgOut->addHTML( $form );
 44+ }
 45+
 46+ function showPageList() {
 47+ global $wgOut, $wgUser, $wgLang;
 48+
 49+ $pager = new ReviewedPagesPager( $this, array(), $this->type, $this->namespace );
 50+ if( $pager->getNumRows() ) {
 51+ $wgOut->addHTML( wfMsgExt('reviewedpages-list', array('parse') ) );
 52+ $wgOut->addHTML( $pager->getNavigationBar() );
 53+ $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
 54+ $wgOut->addHTML( $pager->getNavigationBar() );
 55+ } else {
 56+ $wgOut->addHTML( wfMsgExt('reviewedpages-none', array('parse') ) );
 57+ }
 58+ }
 59+
 60+ function formatRow( $row ) {
 61+ global $wgLang, $wgUser;
 62+
 63+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
 64+ $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() );
 65+
 66+ $stxt = '';
 67+ if( !is_null($size = $row->page_len) ) {
 68+ if($size == 0)
 69+ $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>';
 70+ else
 71+ $stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum( $size ) ) . '</small>';
 72+ }
 73+
 74+ $SVtitle = SpecialPage::getTitleFor( 'Stableversions' );
 75+ $list = $this->skin->makeKnownLinkObj( $SVtitle, wfMsgHtml('reviewedpages-all'),
 76+ 'page=' . $title->getPrefixedUrl() );
 77+ $best = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('reviewedpages-best'),
 78+ 'stableid=best' );
 79+
 80+ return "<li>$link $stxt ($list) [$best]</li>";
 81+ }
 82+}
 83+
 84+/**
 85+ * Query to list out stable versions for a page
 86+ */
 87+class ReviewedPagesPager extends AlphabeticPager {
 88+ public $mForm, $mConds, $namespace, $type;
 89+
 90+ function __construct( $form, $conds = array(), $type=0, $namespace=0 ) {
 91+ $this->mForm = $form;
 92+ $this->mConds = $conds;
 93+ $this->type = $type;
 94+ # Must be a content page...
 95+ global $wgFlaggedRevsNamespaces;
 96+ if( !is_null($namespace) ) {
 97+ $namespace = intval($namespace);
 98+ }
 99+ if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
 100+ $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 101+ }
 102+ $this->namespace = $namespace;
 103+
 104+ parent::__construct();
 105+ }
 106+
 107+ function formatRow( $row ) {
 108+ return $this->mForm->formatRow( $row );
 109+ }
 110+
 111+ function getQueryInfo() {
 112+ $conds = $this->mConds;
 113+ $conds[] = 'page_id = fp_page_id';
 114+ $conds['fp_quality'] = $this->type;
 115+ $conds['page_namespace'] = $this->namespace;
 116+ return array(
 117+ 'tables' => array('flaggedpages','page'),
 118+ 'fields' => 'page_namespace,page_title,page_len,fp_page_id',
 119+ 'conds' => $conds,
 120+ 'options' => array( 'USE INDEX' => array('flaggedpages' => 'fp_quality_page') )
 121+ );
 122+ }
 123+
 124+ function getIndexField() {
 125+ return 'fp_page_id';
 126+ }
 127+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
___________________________________________________________________
Added: svn:eol-style
1128 + native
Index: trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php
@@ -0,0 +1,113 @@
 2+<?php
 3+
 4+class StablePages extends SpecialPage
 5+{
 6+ function __construct() {
 7+ SpecialPage::SpecialPage( 'StablePages' );
 8+ }
 9+
 10+ function execute( $par ) {
 11+ global $wgRequest, $wgUser;
 12+
 13+ $this->setHeaders();
 14+ $this->skin = $wgUser->getSkin();
 15+
 16+ $this->namespace = $wgRequest->getInt( 'namespace' );
 17+
 18+ $this->showForm();
 19+ $this->showPageList();
 20+ }
 21+
 22+ function showForm() {
 23+ global $wgOut, $wgTitle, $wgScript, $wgFlaggedRevsNamespaces;
 24+
 25+ if( count($wgFlaggedRevsNamespaces) > 1 ) {
 26+ $form = Xml::openElement( 'form',
 27+ array( 'name' => 'stablepages', 'action' => $wgScript, 'method' => 'get' ) );
 28+ $form .= "<fieldset><legend>".wfMsg('stablepages')."</legend>\n";
 29+ $form .= Xml::label( wfMsg("namespace"), 'namespace' ) .
 30+ FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
 31+ $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
 32+ $form .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
 33+ $form .= "</fieldset></form>\n";
 34+ $wgOut->addHTML( $form );
 35+ }
 36+ }
 37+
 38+ function showPageList() {
 39+ global $wgOut, $wgUser, $wgLang;
 40+
 41+ $wgOut->addHTML( wfMsgExt('stablepages-text', array('parse') ) );
 42+ $pager = new StablePagesPager( $this, array(), $this->namespace );
 43+ if( $pager->getNumRows() ) {
 44+ $wgOut->addHTML( $pager->getNavigationBar() );
 45+ $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
 46+ $wgOut->addHTML( $pager->getNavigationBar() );
 47+ } else {
 48+ $wgOut->addHTML( wfMsgExt('stablepages-none', array('parse') ) );
 49+ }
 50+ }
 51+
 52+ function formatRow( $row ) {
 53+ global $wgLang, $wgUser;
 54+
 55+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
 56+ $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() );
 57+
 58+ $stitle = SpecialPage::getTitleFor( 'Stabilization' );
 59+ $config = $this->skin->makeKnownLinkObj( $stitle, wfMsgHtml('stablepages-config'),
 60+ 'page=' . $title->getPrefixedUrl() );
 61+ $stable = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('stablepages-stable'),
 62+ 'stable=1' );
 63+ if( $row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry) ) {
 64+ $expiry_description = " (".wfMsgForContent( 'protect-expiring', $wgLang->timeanddate($row->fpc_expiry) ).")";
 65+ } else {
 66+ $expiry_description = "";
 67+ }
 68+
 69+ return "<li>{$link} ({$config}) [{$stable}]{$expiry_description}</li>";
 70+ }
 71+}
 72+
 73+/**
 74+ * Query to list out stable versions for a page
 75+ */
 76+class StablePagesPager extends AlphabeticPager {
 77+ public $mForm, $mConds, $namespace;
 78+
 79+ function __construct( $form, $conds = array(), $namespace=0 ) {
 80+ $this->mForm = $form;
 81+ $this->mConds = $conds;
 82+ # Must be a content page...
 83+ global $wgFlaggedRevsNamespaces;
 84+ if( !is_null($namespace) ) {
 85+ $namespace = intval($namespace);
 86+ }
 87+ if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
 88+ $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 89+ }
 90+ $this->namespace = $namespace;
 91+ parent::__construct();
 92+ }
 93+
 94+ function formatRow( $row ) {
 95+ return $this->mForm->formatRow( $row );
 96+ }
 97+
 98+ function getQueryInfo() {
 99+ $conds = $this->mConds;
 100+ $conds[] = 'page_id = fpc_page_id';
 101+ $conds['fpc_override'] = 1;
 102+ $conds['page_namespace'] = $this->namespace;
 103+ return array(
 104+ 'tables' => array('flaggedpage_config','page'),
 105+ 'fields' => 'page_namespace,page_title,fpc_expiry,fpc_page_id',
 106+ 'conds' => $conds,
 107+ 'options' => array()
 108+ );
 109+ }
 110+
 111+ function getIndexField() {
 112+ return 'fpc_page_id';
 113+ }
 114+}
Property changes on: trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php
___________________________________________________________________
Added: svn:eol-style
1115 + native
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -785,1018 +785,3 @@
786786 }
787787 }
788788 }
789 -
790 -class StableVersions extends UnlistedSpecialPage
791 -{
792 - function __construct() {
793 - UnlistedSpecialPage::UnlistedSpecialPage( 'StableVersions' );
794 - }
795 -
796 - function execute( $par ) {
797 - global $wgRequest, $wgUser, $wgOut;
798 -
799 - $this->setHeaders();
800 - $this->skin = $wgUser->getSkin();
801 - # Our target page
802 - $this->target = $wgRequest->getText( 'page' );
803 - $this->page = Title::newFromUrl( $this->target );
804 - # Revision ID
805 - $this->oldid = $wgRequest->getVal( 'oldid' );
806 - $this->oldid = ($this->oldid=='best') ? 'best' : intval($this->oldid);
807 - # We need a page...
808 - if( is_null($this->page) ) {
809 - $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
810 - return;
811 - }
812 -
813 - $this->showStableList();
814 - }
815 -
816 - function showStableList() {
817 - global $wgOut, $wgUser;
818 - # Must be a content page
819 - if( !FlaggedRevs::isPageReviewable( $this->page ) ) {
820 - $wgOut->addHTML( wfMsgExt('stableversions-none', array('parse'),
821 - $this->page->getPrefixedText() ) );
822 - return;
823 - }
824 - $pager = new StableRevisionsPager( $this, array(), $this->page );
825 - if( $pager->getNumRows() ) {
826 - $wgOut->addHTML( wfMsgExt('stableversions-list', array('parse'),
827 - $this->page->getPrefixedText() ) );
828 - $wgOut->addHTML( $pager->getNavigationBar() );
829 - $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
830 - $wgOut->addHTML( $pager->getNavigationBar() );
831 - } else {
832 - $wgOut->addHTML( wfMsgExt('stableversions-none', array('parse'),
833 - $this->page->getPrefixedText() ) );
834 - }
835 - }
836 -
837 - function formatRow( $row ) {
838 - global $wgLang, $wgUser;
839 -
840 - $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->rev_timestamp), true );
841 - $ftime = $wgLang->timeanddate( wfTimestamp(TS_MW, $row->fr_timestamp), true );
842 - $review = wfMsg( 'stableversions-review', $ftime,
843 - $this->skin->userLink( $row->fr_user, $row->user_name ) .
844 - ' ' . $this->skin->userToolLinks( $row->fr_user, $row->user_name ) );
845 -
846 - $lev = ( $row->fr_quality >=1 ) ? wfMsg('hist-quality') : wfMsg('hist-stable');
847 - $link = $this->skin->makeKnownLinkObj( $this->page, $time,
848 - 'stableid='.$row->fr_rev_id );
849 -
850 - return '<li>'.$link.' ('.$review.') <strong>['.$lev.']</strong></li>';
851 - }
852 -}
853 -
854 -/**
855 - * Query to list out stable versions for a page
856 - */
857 -class StableRevisionsPager extends ReverseChronologicalPager {
858 - public $mForm, $mConds;
859 -
860 - function __construct( $form, $conds = array(), $title ) {
861 - $this->mForm = $form;
862 - $this->mConds = $conds;
863 - $this->namespace = $title->getNamespace();
864 - $this->pageID = $title->getArticleID();
865 -
866 - parent::__construct();
867 - }
868 -
869 - function formatRow( $row ) {
870 - return $this->mForm->formatRow( $row );
871 - }
872 -
873 - function getQueryInfo() {
874 - global $wgFlaggedRevsNamespaces;
875 -
876 - $conds = $this->mConds;
877 - # Must be in a reviewable namespace
878 - if( !in_array($this->namespace, $wgFlaggedRevsNamespaces) ) {
879 - $conds[] = "1 = 0";
880 - }
881 - $conds["fr_page_id"] = $this->pageID;
882 - $conds[] = "fr_rev_id = rev_id";
883 - $conds[] = "fr_user = user_id";
884 - $conds[] = 'rev_deleted & '.Revision::DELETED_TEXT.' = 0';
885 - return array(
886 - 'tables' => array('flaggedrevs','revision','user'),
887 - 'fields' => 'fr_rev_id,fr_timestamp,rev_timestamp,fr_quality,fr_user,user_name',
888 - 'conds' => $conds,
889 - 'options' => array( 'USE INDEX' => array('flaggedrevs' => 'PRIMARY') )
890 - );
891 - }
892 -
893 - function getIndexField() {
894 - return 'fr_rev_id';
895 - }
896 -}
897 -
898 -/**
899 - * Special page to list unreviewed pages
900 - */
901 -class UnreviewedPages extends SpecialPage
902 -{
903 - function __construct() {
904 - SpecialPage::SpecialPage( 'UnreviewedPages', 'unreviewedpages' );
905 - }
906 -
907 - function execute( $par ) {
908 - global $wgRequest, $wgUser, $wgOut;
909 - $this->setHeaders();
910 - if( !$wgUser->isAllowed( 'unreviewedpages' ) ) {
911 - $wgOut->permissionRequired( 'unreviewedpages' );
912 - return;
913 - }
914 - $this->skin = $wgUser->getSkin();
915 - $this->showList( $wgRequest );
916 - }
917 -
918 - function showList( $wgRequest ) {
919 - global $wgOut, $wgScript, $wgTitle, $wgFlaggedRevsNamespaces;
920 - # If no NS given, then just use the first of $wgFlaggedRevsNamespaces
921 - $defaultNS = empty($wgFlaggedRevsNamespaces) ? 0 : $wgFlaggedRevsNamespaces[0];
922 - $namespace = $wgRequest->getIntOrNull( 'namespace', $defaultNS );
923 - $category = trim( $wgRequest->getVal( 'category' ) );
924 -
925 - $action = htmlspecialchars( $wgScript );
926 - $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
927 - '<fieldset><legend>' . wfMsg('unreviewed-legend') . '</legend>' .
928 - Xml::hidden( 'title', $wgTitle->getPrefixedText() ) . '<p>' );
929 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
930 - $wgOut->addHTML( Xml::label( wfMsg("namespace"), 'namespace' ) .
931 - FlaggedRevsXML::getNamespaceMenu( $namespace ) ) . '&nbsp;';
932 - }
933 - $wgOut->addHTML( Xml::label( wfMsg("unreviewed-category"), 'category' ) .
934 - ' ' . Xml::input( 'category', 35, $category, array('id' => 'category') ) .
935 - '&nbsp;&nbsp;' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
936 - "</fieldset></form>"
937 - );
938 - # This will start to get slower...
939 - if( $category || self::generalQueryOK() ) {
940 - $pager = new UnreviewedPagesPager( $this, $namespace, $category );
941 - if( $pager->getNumRows() ) {
942 - $wgOut->addHTML( wfMsgExt('unreviewed-list', array('parse') ) );
943 - $wgOut->addHTML( $pager->getNavigationBar() );
944 - $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
945 - $wgOut->addHTML( $pager->getNavigationBar() );
946 - } else {
947 - $wgOut->addHTML( wfMsgExt('unreviewed-none', array('parse') ) );
948 - }
949 - }
950 - }
951 -
952 - function formatRow( $result ) {
953 - global $wgLang, $wgUser;
954 -
955 - $title = Title::makeTitle( $result->page_namespace, $result->page_title );
956 - $link = $this->skin->makeKnownLinkObj( $title );
957 - $css = $stxt = $review = '';
958 - if( !is_null($size = $result->page_len) ) {
959 - global $wgLang;
960 - $stxt = ($size == 0) ?
961 - wfMsgHtml('historyempty') : wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
962 - $stxt = " <small>$stxt</small>";
963 - }
964 - if( $wgUser->isAllowed('unwatchedpages') ) {
965 - $uw = self::usersWatching( $title );
966 - $watching = $uw ? wfMsgExt("unreviewed-watched",array('parsemag'),$uw,$uw) : wfMsgHtml("unreviewed-unwatched");
967 - $watching = " $watching";
968 - // Oh-noes!
969 - $css = $uw ? "" : " class='fr-unreviewed-unwatched'";
970 - } else {
971 - $watching = "";
972 - }
973 -
974 - return( "<li{$css}>{$link} {$stxt} {$review}{$watching}</li>" );
975 - }
976 -
977 - /**
978 - * Get number of users watching a page. Max is 5.
979 - * @param Title $title
980 - */
981 - public static function usersWatching( $title ) {
982 - global $wgMiserMode;
983 - $dbr = wfGetDB( DB_SLAVE );
984 - if( $wgMiserMode ) {
985 - # Get a rough idea of size
986 - $count = $dbr->estimateRowCount( 'watchlist', '*',
987 - array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
988 - __METHOD__ );
989 - # If it is small, just COUNT() it, otherwise, stick with estimate...
990 - if( $count <= 10 ) {
991 - $count = $dbr->selectField( 'watchlist', 'COUNT(*)',
992 - array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
993 - __METHOD__ );
994 - }
995 - } else {
996 - $count = $dbr->selectField( 'watchlist', 'COUNT(*)',
997 - array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
998 - __METHOD__ );
999 - }
1000 - return $count;
1001 - }
1002 -
1003 - /**
1004 - * There may be many pages, most of which are reviewed
1005 - */
1006 - public static function generalQueryOK() {
1007 - global $wgFlaggedRevsNamespaces;
1008 - if( !wfQueriesMustScale() )
1009 - return true;
1010 - # Get est. of fraction of pages that are reviewed
1011 - $dbr = wfGetDB( DB_SLAVE );
1012 - $reviewedpages = $dbr->estimateRowCount( 'flaggedpages', '*', array(), __METHOD__ );
1013 - $pages = $dbr->estimateRowCount( 'page', '*', array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ );
1014 - $ratio = $pages/($pages - $reviewedpages);
1015 - # If dist. is normalized, # of rows scanned = $ratio * LIMIT (or until list runs out)
1016 - return ($ratio <= 200);
1017 - }
1018 -}
1019 -
1020 -/**
1021 - * Query to list out unreviewed pages
1022 - */
1023 -class UnreviewedPagesPager extends AlphabeticPager {
1024 - public $mForm, $mConds;
1025 - private $namespace, $category;
1026 -
1027 - function __construct( $form, $namespace, $category=NULL, $conds = array() ) {
1028 - $this->mForm = $form;
1029 - $this->mConds = $conds;
1030 - # Must be a content page...
1031 - global $wgFlaggedRevsNamespaces;
1032 - if( !is_null($namespace) ) {
1033 - $namespace = intval($namespace);
1034 - }
1035 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
1036 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
1037 - }
1038 - $this->namespace = $namespace;
1039 - $this->category = $category ? str_replace(' ','_',$category) : NULL;
1040 -
1041 - parent::__construct();
1042 - }
1043 -
1044 - function formatRow( $row ) {
1045 - return $this->mForm->formatRow( $row );
1046 - }
1047 -
1048 - function getQueryInfo() {
1049 - $conds = $this->mConds;
1050 - $fields = array('page_namespace','page_title','page_len','fp_stable');
1051 - $conds[] = 'fp_reviewed IS NULL';
1052 - # Reviewable pages only
1053 - $conds['page_namespace'] = $this->namespace;
1054 - # No redirects
1055 - $conds['page_is_redirect'] = 0;
1056 - # Filter by category
1057 - if( $this->category ) {
1058 - $tables = array( 'categorylinks', 'page', 'flaggedpages' );
1059 - $fields[] = 'cl_sortkey';
1060 - $conds['cl_to'] = $this->category;
1061 - $conds[] = 'cl_from = page_id';
1062 - $this->mIndexField = 'cl_sortkey';
1063 - $useIndex = array( 'categorylinks' => 'cl_sortkey' );
1064 - } else {
1065 - $tables = array( 'page', 'flaggedpages' );
1066 - $fields[] = 'page_id';
1067 - $this->mIndexField = 'page_title';
1068 - $useIndex = array( 'page' => 'name_title' );
1069 - }
1070 - return array(
1071 - 'tables' => $tables,
1072 - 'fields' => $fields,
1073 - 'conds' => $conds,
1074 - 'options' => array( 'USE INDEX' => $useIndex ),
1075 - 'join_conds' => array( 'flaggedpages' => array('LEFT JOIN','fp_page_id=page_id') )
1076 - );
1077 - }
1078 -
1079 - function getIndexField() {
1080 - return $this->mIndexField;
1081 - }
1082 -}
1083 -
1084 -/**
1085 - * Special page to list unreviewed pages
1086 - */
1087 -class OldReviewedPages extends SpecialPage
1088 -{
1089 - function __construct() {
1090 - SpecialPage::SpecialPage( 'OldReviewedPages', 'unreviewedpages' );
1091 - }
1092 -
1093 - function execute( $par ) {
1094 - global $wgRequest, $wgUser, $wgOut;
1095 - $this->setHeaders();
1096 - if( !$wgUser->isAllowed( 'unreviewedpages' ) ) {
1097 - $wgOut->permissionRequired( 'unreviewedpages' );
1098 - return;
1099 - }
1100 - $this->skin = $wgUser->getSkin();
1101 - $this->showList( $wgRequest );
1102 - }
1103 -
1104 - function showList( $wgRequest ) {
1105 - global $wgOut, $wgScript, $wgTitle, $wgFlaggedRevsNamespaces;
1106 -
1107 - $namespace = $wgRequest->getIntOrNull( 'namespace' );
1108 - $category = trim( $wgRequest->getVal( 'category' ) );
1109 -
1110 - $action = htmlspecialchars( $wgScript );
1111 -
1112 - $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
1113 - '<fieldset><legend>' . wfMsg('oldreviewedpages-legend') . '</legend>');
1114 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
1115 - $wgOut->addHTML( Xml::label( wfMsg("namespace"), 'namespace' ) .
1116 - FlaggedRevsXML::getNamespaceMenu( $namespace ) . '&nbsp;' );
1117 - }
1118 - $wgOut->addHTML( Xml::hidden( 'title', $wgTitle->getPrefixedText() ) .
1119 - Xml::label( wfMsg("unreviewed-category"), 'category' ) .
1120 - ' ' . Xml::input( 'category', 35, $category, array('id' => 'category') ) .
1121 - '&nbsp;&nbsp;' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
1122 - "</fieldset></form>" );
1123 -
1124 - $pager = new OldReviewedPagesPager( $this, $namespace, $category );
1125 - if( $pager->getNumRows() ) {
1126 - $wgOut->addHTML( wfMsgExt('oldreviewedpages-list', array('parse') ) );
1127 - $wgOut->addHTML( $pager->getNavigationBar() );
1128 - $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
1129 - $wgOut->addHTML( $pager->getNavigationBar() );
1130 - } else {
1131 - $wgOut->addHTML( wfMsgExt('oldreviewedpages-none', array('parse') ) );
1132 - }
1133 - }
1134 -
1135 - function formatRow( $result ) {
1136 - global $wgLang, $wgFlaggedRevsLongPending;
1137 -
1138 - $title = Title::makeTitle( $result->page_namespace, $result->page_title );
1139 - $link = $this->skin->makeKnownLinkObj( $title );
1140 - $css = $stxt = $review = '';
1141 - if( !is_null($size = $result->page_len) ) {
1142 - $stxt = ($size == 0) ?
1143 - wfMsgHtml('historyempty') : wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
1144 - $stxt = " <small>$stxt</small>";
1145 - }
1146 - $review = $this->skin->makeKnownLinkObj( $title, wfMsg('unreviewed-diff'),
1147 - "diff=cur&oldid={$result->fp_stable}" );
1148 - $quality = $result->fp_quality ? wfMsgHtml('oldreviewedpages-quality') : wfMsgHtml('oldreviewedpages-stable');
1149 - # Get how long the first unreviewed edit has been waiting...
1150 - $firstPending = $title->getNextRevisionID($result->fp_stable);
1151 - if( $firstPendingTime = Revision::getTimestampFromID($firstPending) ) {
1152 - $currentTime = wfTimestamp( TS_UNIX ); // now
1153 - $firstPendingTime = wfTimestamp( TS_UNIX, $firstPendingTime );
1154 - $hours = ($currentTime - $firstPendingTime)/3600;
1155 - // After three days, just use days
1156 - if( $hours > (3*24) ) {
1157 - $days = round($hours/24,0);
1158 - $age = wfMsgExt('oldreviewedpages-days',array('parsemag'),$days);
1159 - // If one or more hours, use hours
1160 - } else if( $hours >= 1 ) {
1161 - $hours = round($hours,0);
1162 - $age = wfMsgExt('oldreviewedpages-hours',array('parsemag'),$hours);
1163 - } else {
1164 - $age = wfMsg('oldreviewedpages-recent'); // hot of the press :)
1165 - }
1166 - // Oh-noes!
1167 - $css = ($hours > $wgFlaggedRevsLongPending) ? " class='fr-pending-long'" : "";
1168 - } else {
1169 - $age = ""; // wtf?
1170 - }
1171 - # Is anybody watching?
1172 - $uw = UnreviewedPages::usersWatching( $title );
1173 - $watching = $uw ? wfMsgExt("unreviewed-watched",array('parsemag'),$uw,$uw) : wfMsgHtml("unreviewed-unwatched");
1174 -
1175 - return( "<li{$css}>{$link} {$stxt} ({$review}) <i>{$age}</i> <strong>[{$quality}]</strong> {$watching}</li>" );
1176 - }
1177 -}
1178 -
1179 -/**
1180 - * Query to list out unreviewed pages
1181 - */
1182 -class OldReviewedPagesPager extends AlphabeticPager {
1183 - public $mForm, $mConds;
1184 - private $category, $namespace;
1185 -
1186 - function __construct( $form, $namespace, $category=NULL, $conds = array() ) {
1187 - $this->mForm = $form;
1188 - $this->mConds = $conds;
1189 - # Must be a content page...
1190 - global $wgFlaggedRevsNamespaces;
1191 - if( !is_null($namespace) ) {
1192 - $namespace = intval($namespace);
1193 - }
1194 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
1195 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
1196 - }
1197 - $this->namespace = $namespace;
1198 - $this->category = $category ? str_replace(' ','_',$category) : NULL;
1199 -
1200 - parent::__construct();
1201 - }
1202 -
1203 - function formatRow( $row ) {
1204 - return $this->mForm->formatRow( $row );
1205 - }
1206 -
1207 - function getQueryInfo() {
1208 - $conds = $this->mConds;
1209 - $tables = array( 'flaggedpages', 'page' );
1210 - $fields = array('page_namespace','page_title','page_len','fp_stable','fp_quality','fp_page_id');
1211 - $conds['fp_reviewed'] = 0;
1212 - $conds[] = 'page_id = fp_page_id';
1213 - $conds['page_namespace'] = $this->namespace;
1214 - $useIndex = array('flaggedpages' => 'fp_reviewed_page','page' => 'PRIMARY');
1215 - # Filter by category
1216 - if( $this->category ) {
1217 - $tables[] = 'categorylinks';
1218 - $conds[] = 'cl_from = page_id';
1219 - $conds['cl_to'] = $this->category;
1220 - $useIndex['categorylinks'] = 'cl_from';
1221 - }
1222 - return array(
1223 - 'tables' => $tables,
1224 - 'fields' => $fields,
1225 - 'conds' => $conds,
1226 - 'options' => array( 'USE INDEX' => $useIndex )
1227 - );
1228 - }
1229 -
1230 - function getIndexField() {
1231 - return 'fp_page_id';
1232 - }
1233 -}
1234 -
1235 -class ReviewedPages extends SpecialPage
1236 -{
1237 - function __construct() {
1238 - SpecialPage::SpecialPage( 'ReviewedPages' );
1239 - }
1240 -
1241 - function execute( $par ) {
1242 - global $wgRequest, $wgUser, $wgFlaggedRevValues, $wgFlaggedRevPristine;
1243 -
1244 - $this->setHeaders();
1245 - $this->skin = $wgUser->getSkin();
1246 -
1247 - # Check if there is a featured level
1248 - $maxType = FlaggedRevs::pristineVersions() ? 2 : 1;
1249 - $this->namespace = $wgRequest->getInt( 'namespace' );
1250 - $this->type = $wgRequest->getInt( 'level' );
1251 - $this->type = $this->type <= $maxType ? $this->type : 0;
1252 -
1253 - $this->showForm();
1254 - $this->showPageList();
1255 - }
1256 -
1257 - function showForm() {
1258 - global $wgOut, $wgTitle, $wgScript, $wgFlaggedRevsNamespaces;
1259 -
1260 - $form = Xml::openElement( 'form',
1261 - array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) );
1262 - $form .= "<fieldset><legend>".wfMsg('reviewedpages-leg')."</legend>\n";
1263 -
1264 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
1265 - $form .= Xml::label( wfMsg("namespace"), 'namespace' ) .
1266 - FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
1267 - }
1268 - $form .= FlaggedRevsXML::getLevelMenu( $this->type );
1269 -
1270 - $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
1271 - $form .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
1272 - $form .= "</fieldset></form>\n";
1273 -
1274 - $wgOut->addHTML( $form );
1275 - }
1276 -
1277 - function showPageList() {
1278 - global $wgOut, $wgUser, $wgLang;
1279 -
1280 - $pager = new ReviewedPagesPager( $this, array(), $this->type, $this->namespace );
1281 - if( $pager->getNumRows() ) {
1282 - $wgOut->addHTML( wfMsgExt('reviewedpages-list', array('parse') ) );
1283 - $wgOut->addHTML( $pager->getNavigationBar() );
1284 - $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
1285 - $wgOut->addHTML( $pager->getNavigationBar() );
1286 - } else {
1287 - $wgOut->addHTML( wfMsgExt('reviewedpages-none', array('parse') ) );
1288 - }
1289 - }
1290 -
1291 - function formatRow( $row ) {
1292 - global $wgLang, $wgUser;
1293 -
1294 - $title = Title::makeTitle( $row->page_namespace, $row->page_title );
1295 - $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() );
1296 -
1297 - $stxt = '';
1298 - if( !is_null($size = $row->page_len) ) {
1299 - if($size == 0)
1300 - $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>';
1301 - else
1302 - $stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum( $size ) ) . '</small>';
1303 - }
1304 -
1305 - $SVtitle = SpecialPage::getTitleFor( 'Stableversions' );
1306 - $list = $this->skin->makeKnownLinkObj( $SVtitle, wfMsgHtml('reviewedpages-all'),
1307 - 'page=' . $title->getPrefixedUrl() );
1308 - $best = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('reviewedpages-best'),
1309 - 'stableid=best' );
1310 -
1311 - return "<li>$link $stxt ($list) [$best]</li>";
1312 - }
1313 -}
1314 -
1315 -/**
1316 - * Query to list out stable versions for a page
1317 - */
1318 -class ReviewedPagesPager extends AlphabeticPager {
1319 - public $mForm, $mConds, $namespace, $type;
1320 -
1321 - function __construct( $form, $conds = array(), $type=0, $namespace=0 ) {
1322 - $this->mForm = $form;
1323 - $this->mConds = $conds;
1324 - $this->type = $type;
1325 - # Must be a content page...
1326 - global $wgFlaggedRevsNamespaces;
1327 - if( !is_null($namespace) ) {
1328 - $namespace = intval($namespace);
1329 - }
1330 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
1331 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
1332 - }
1333 - $this->namespace = $namespace;
1334 -
1335 - parent::__construct();
1336 - }
1337 -
1338 - function formatRow( $row ) {
1339 - return $this->mForm->formatRow( $row );
1340 - }
1341 -
1342 - function getQueryInfo() {
1343 - $conds = $this->mConds;
1344 - $conds[] = 'page_id = fp_page_id';
1345 - $conds['fp_quality'] = $this->type;
1346 - $conds['page_namespace'] = $this->namespace;
1347 - return array(
1348 - 'tables' => array('flaggedpages','page'),
1349 - 'fields' => 'page_namespace,page_title,page_len,fp_page_id',
1350 - 'conds' => $conds,
1351 - 'options' => array( 'USE INDEX' => array('flaggedpages' => 'fp_quality_page') )
1352 - );
1353 - }
1354 -
1355 - function getIndexField() {
1356 - return 'fp_page_id';
1357 - }
1358 -}
1359 -
1360 -class StablePages extends SpecialPage
1361 -{
1362 - function __construct() {
1363 - SpecialPage::SpecialPage( 'StablePages' );
1364 - }
1365 -
1366 - function execute( $par ) {
1367 - global $wgRequest, $wgUser;
1368 -
1369 - $this->setHeaders();
1370 - $this->skin = $wgUser->getSkin();
1371 -
1372 - $this->namespace = $wgRequest->getInt( 'namespace' );
1373 -
1374 - $this->showForm();
1375 - $this->showPageList();
1376 - }
1377 -
1378 - function showForm() {
1379 - global $wgOut, $wgTitle, $wgScript, $wgFlaggedRevsNamespaces;
1380 -
1381 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
1382 - $form = Xml::openElement( 'form',
1383 - array( 'name' => 'stablepages', 'action' => $wgScript, 'method' => 'get' ) );
1384 - $form .= "<fieldset><legend>".wfMsg('stablepages')."</legend>\n";
1385 - $form .= Xml::label( wfMsg("namespace"), 'namespace' ) .
1386 - FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
1387 - $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
1388 - $form .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
1389 - $form .= "</fieldset></form>\n";
1390 - $wgOut->addHTML( $form );
1391 - }
1392 - }
1393 -
1394 - function showPageList() {
1395 - global $wgOut, $wgUser, $wgLang;
1396 -
1397 - $wgOut->addHTML( wfMsgExt('stablepages-text', array('parse') ) );
1398 - $pager = new StablePagesPager( $this, array(), $this->namespace );
1399 - if( $pager->getNumRows() ) {
1400 - $wgOut->addHTML( $pager->getNavigationBar() );
1401 - $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
1402 - $wgOut->addHTML( $pager->getNavigationBar() );
1403 - } else {
1404 - $wgOut->addHTML( wfMsgExt('stablepages-none', array('parse') ) );
1405 - }
1406 - }
1407 -
1408 - function formatRow( $row ) {
1409 - global $wgLang, $wgUser;
1410 -
1411 - $title = Title::makeTitle( $row->page_namespace, $row->page_title );
1412 - $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() );
1413 -
1414 - $stitle = SpecialPage::getTitleFor( 'Stabilization' );
1415 - $config = $this->skin->makeKnownLinkObj( $stitle, wfMsgHtml('stablepages-config'),
1416 - 'page=' . $title->getPrefixedUrl() );
1417 - $stable = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('stablepages-stable'),
1418 - 'stable=1' );
1419 - if( $row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry) ) {
1420 - $expiry_description = " (".wfMsgForContent( 'protect-expiring', $wgLang->timeanddate($row->fpc_expiry) ).")";
1421 - } else {
1422 - $expiry_description = "";
1423 - }
1424 -
1425 - return "<li>{$link} ({$config}) [{$stable}]{$expiry_description}</li>";
1426 - }
1427 -}
1428 -
1429 -/**
1430 - * Query to list out stable versions for a page
1431 - */
1432 -class StablePagesPager extends AlphabeticPager {
1433 - public $mForm, $mConds, $namespace;
1434 -
1435 - function __construct( $form, $conds = array(), $namespace=0 ) {
1436 - $this->mForm = $form;
1437 - $this->mConds = $conds;
1438 - # Must be a content page...
1439 - global $wgFlaggedRevsNamespaces;
1440 - if( !is_null($namespace) ) {
1441 - $namespace = intval($namespace);
1442 - }
1443 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
1444 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
1445 - }
1446 - $this->namespace = $namespace;
1447 - parent::__construct();
1448 - }
1449 -
1450 - function formatRow( $row ) {
1451 - return $this->mForm->formatRow( $row );
1452 - }
1453 -
1454 - function getQueryInfo() {
1455 - $conds = $this->mConds;
1456 - $conds[] = 'page_id = fpc_page_id';
1457 - $conds['fpc_override'] = 1;
1458 - $conds['page_namespace'] = $this->namespace;
1459 - return array(
1460 - 'tables' => array('flaggedpage_config','page'),
1461 - 'fields' => 'page_namespace,page_title,fpc_expiry,fpc_page_id',
1462 - 'conds' => $conds,
1463 - 'options' => array()
1464 - );
1465 - }
1466 -
1467 - function getIndexField() {
1468 - return 'fpc_page_id';
1469 - }
1470 -}
1471 -
1472 -class Stabilization extends UnlistedSpecialPage
1473 -{
1474 - function __construct() {
1475 - UnlistedSpecialPage::UnlistedSpecialPage( 'Stabilization', 'stablesettings' );
1476 - }
1477 -
1478 - function execute( $par ) {
1479 - global $wgRequest, $wgUser, $wgOut;
1480 -
1481 - $confirm = $wgRequest->wasPosted() &&
1482 - $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
1483 -
1484 - $this->isAllowed = $wgUser->isAllowed( 'stablesettings' );
1485 - # Let anyone view, but not submit...
1486 - if( $wgRequest->wasPosted() ) {
1487 - if( $wgUser->isBlocked( !$confirm ) ) {
1488 - $wgOut->blockedPage();
1489 - return;
1490 - } else if( !$this->isAllowed ) {
1491 - $wgOut->permissionRequired( 'stablesettings' );
1492 - return;
1493 - } else if( wfReadOnly() ) {
1494 - $wgOut->readOnlyPage();
1495 - return;
1496 - }
1497 - }
1498 -
1499 - $this->setHeaders();
1500 - $this->skin = $wgUser->getSkin();
1501 -
1502 - $isValid = true;
1503 - # Our target page
1504 - $this->target = $wgRequest->getText( 'page' );
1505 - $this->page = Title::newFromUrl( $this->target );
1506 - # We need a page...
1507 - if( is_null($this->page) ) {
1508 - $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
1509 - return;
1510 - } else if( !$this->page->exists() ) {
1511 - $wgOut->addHTML( wfMsgExt( 'stabilization-notexists', array('parseinline'), $this->page->getPrefixedText() ) );
1512 - return;
1513 - } else if( !FlaggedRevs::isPageReviewable( $this->page ) ) {
1514 - $wgOut->addHTML( wfMsgExt( 'stabilization-notcontent', array('parseinline'), $this->page->getPrefixedText() ) );
1515 - return;
1516 - }
1517 -
1518 - # Watch checkbox
1519 - $this->watchThis = $wgRequest->getCheck( 'wpWatchthis' );
1520 - # Reason
1521 - $this->comment = $wgRequest->getVal( 'wpReason' );
1522 - # Get visiblity settings...
1523 - $config = FlaggedRevs::getPageVisibilitySettings( $this->page, true );
1524 - $this->select = $config['select'];
1525 - $this->override = $config['override'];
1526 - $this->expiry = $config['expiry'] !== 'infinity' ? wfTimestamp( TS_RFC2822, $config['expiry'] ) : 'infinite';
1527 - if( $wgRequest->wasPosted() ) {
1528 - $this->select = $wgRequest->getInt( 'mwStableconfig-select' );
1529 - $this->override = intval( $wgRequest->getBool( 'mwStableconfig-override' ) );
1530 - $this->expiry = $wgRequest->getText( 'mwStableconfig-expiry' );
1531 - if( strlen( $this->expiry ) == 0 ) {
1532 - $this->expiry = 'infinite';
1533 - }
1534 - if( $this->select && !in_array( $this->select, array(FLAGGED_VIS_NORMAL,FLAGGED_VIS_LATEST) ) ) {
1535 - $isValid = false;
1536 - }
1537 - }
1538 -
1539 - if( $isValid && $confirm ) {
1540 - $this->submit();
1541 - } else {
1542 - $this->showSettings();
1543 - }
1544 - }
1545 -
1546 - function showSettings( $err = null ) {
1547 - global $wgOut, $wgTitle, $wgUser;
1548 -
1549 - $wgOut->setRobotpolicy( 'noindex,nofollow' );
1550 - # Must be a content page
1551 - if( !FlaggedRevs::isPageReviewable( $this->page ) ) {
1552 - $wgOut->addHTML( wfMsgExt('stableversions-none', array('parse'), $this->page->getPrefixedText() ) );
1553 - return;
1554 - }
1555 -
1556 - if ( "" != $err ) {
1557 - $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
1558 - $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
1559 - }
1560 -
1561 - if( !$this->isAllowed ) {
1562 - $form = wfMsgExt( 'stabilization-perm', array('parse'), $this->page->getPrefixedText() );
1563 - $off = array('disabled' => 'disabled');
1564 - } else {
1565 - $form = wfMsgExt( 'stabilization-text', array('parse'), $this->page->getPrefixedText() );
1566 - $off = array();
1567 - }
1568 -
1569 - $special = SpecialPage::getTitleFor( 'Stabilization' );
1570 - $form .= Xml::openElement( 'form', array( 'name' => 'stabilization', 'action' => $special->getLocalUrl( ), 'method' => 'post' ) );
1571 -
1572 - $form .= "<fieldset><legend>".wfMsg('stabilization-def')."</legend>";
1573 - $form .= "<table><tr>";
1574 - $form .= "<td>".Xml::radio( 'mwStableconfig-override', 1, (1==$this->override), array('id' => 'default-stable')+$off)."</td>";
1575 - $form .= "<td>".Xml::label( wfMsg('stabilization-def1'), 'default-stable' )."</td>";
1576 - $form .= "</tr><tr>";
1577 - $form .= "<td>".Xml::radio( 'mwStableconfig-override', 0, (0==$this->override), array('id' => 'default-current')+$off)."</td>";
1578 - $form .= "<td>".Xml::label( wfMsg('stabilization-def2'), 'default-current' )."</td>";
1579 - $form .= "</tr></table></fieldset>";
1580 -
1581 - $form .= "<fieldset><legend>".wfMsg('stabilization-select')."</legend>";
1582 - $form .= "<table><tr>";
1583 - /*
1584 - $form .= "<td>".Xml::radio( 'mwStableconfig-select', FLAGGED_VIS_PRISTINE,
1585 - (FLAGGED_VIS_PRISTINE==$this->select), array('id' => 'stable-select3')+$off )."</td>";
1586 - $form .= "<td>".Xml::label( wfMsg('stabilization-select3'), 'stable-select3' )."</td>";
1587 - $form .= "</tr><tr>";
1588 - */
1589 - $form .= "<td>".Xml::radio( 'mwStableconfig-select', FLAGGED_VIS_NORMAL,
1590 - (FLAGGED_VIS_NORMAL==$this->select), array('id' => 'stable-select1')+$off )."</td>";
1591 - $form .= "<td>".Xml::label( wfMsg('stabilization-select1'), 'stable-select1' )."</td>";
1592 - $form .= "</tr><tr>";
1593 - $form .= "<td>".Xml::radio( 'mwStableconfig-select', FLAGGED_VIS_LATEST,
1594 - (FLAGGED_VIS_LATEST==$this->select), array('id' => 'stable-select2')+$off )."</td>";
1595 - $form .= "<td>".Xml::label( wfMsg('stabilization-select2'), 'stable-select2' )."</td>";
1596 - $form .= "</tr></table></fieldset>";
1597 -
1598 - if( $this->isAllowed ) {
1599 - $form .= "<fieldset><legend>".wfMsgHtml('stabilization-leg')."</legend>";
1600 - $form .= '<table>';
1601 - $form .= '<tr><td>'.Xml::label( wfMsg('stabilization-comment'), 'wpReason' ).'</td>';
1602 - $form .= '<td>'.Xml::input( 'wpReason', 60, $this->comment, array('id' => 'wpReason') )."</td></tr>";
1603 - } else {
1604 - $form .= '<table>';
1605 - }
1606 - $form .= '<tr>';
1607 - $form .= '<td><label for="expires">' . wfMsgExt( 'stabilization-expiry', array( 'parseinline' ) ) . '</label></td>';
1608 - $form .= '<td>' . Xml::input( 'mwStableconfig-expiry', 60, $this->expiry, array('id' => 'expires')+$off ) . '</td>';
1609 - $form .= '</tr>';
1610 - $form .= '</table>';
1611 -
1612 - if( $this->isAllowed ) {
1613 - $watchLabel = wfMsgExt('watchthis', array('parseinline'));
1614 - $watchAttribs = array('accesskey' => wfMsg( 'accesskey-watch' ), 'id' => 'wpWatchthis');
1615 - $watchChecked = ( $wgUser->getOption( 'watchdefault' ) || $wgTitle->userIsWatching() );
1616 -
1617 - $form .= "<p>&nbsp;&nbsp;&nbsp;".Xml::check( 'wpWatchthis', $watchChecked, $watchAttribs );
1618 - $form .= "&nbsp;<label for='wpWatchthis'".$this->skin->tooltipAndAccesskey('watch').">{$watchLabel}</label></p>";
1619 -
1620 - $form .= Xml::hidden( 'title', $wgTitle->getPrefixedText() );
1621 - $form .= Xml::hidden( 'page', $this->page->getPrefixedText() );
1622 - $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() );
1623 -
1624 - $form .= '<p>'.Xml::submitButton( wfMsg( 'stabilization-submit' ) ).'</p>';
1625 - $form .= "</fieldset>";
1626 - }
1627 -
1628 - $form .= '</form>';
1629 -
1630 - $wgOut->addHTML( $form );
1631 -
1632 - $wgOut->addHtml( Xml::element( 'h2', NULL, htmlspecialchars( LogPage::logName( 'stable' ) ) ) );
1633 - $logViewer = new LogViewer(
1634 - new LogReader( new FauxRequest(
1635 - array( 'page' => $this->page->getPrefixedText(), 'type' => 'stable' ) ) ) );
1636 - $logViewer->showList( $wgOut );
1637 - }
1638 -
1639 - function submit() {
1640 - global $wgOut, $wgUser, $wgParser, $wgFlaggedRevsOverride, $wgFlaggedRevsPrecedence;
1641 -
1642 - $changed = $reset = false;
1643 - # Take this opportunity to purge out expired configurations
1644 - FlaggedRevs::purgeExpiredConfigurations();
1645 -
1646 - if( $this->expiry == 'infinite' || $this->expiry == 'indefinite' ) {
1647 - $expiry = Block::infinity();
1648 - } else {
1649 - # Convert GNU-style date, on error returns -1 for PHP <5.1 and false for PHP >=5.1
1650 - $expiry = strtotime( $this->expiry );
1651 -
1652 - if( $expiry < 0 || $expiry === false ) {
1653 - $this->showSettings( wfMsg( 'stabilize_expiry_invalid' ) );
1654 - return false;
1655 - }
1656 -
1657 - $expiry = wfTimestamp( TS_MW, $expiry );
1658 -
1659 - if ( $expiry < wfTimestampNow() ) {
1660 - $this->showSettings( wfMsg( 'stabilize_expiry_old' ) );
1661 - return false;
1662 - }
1663 - }
1664 -
1665 - $dbw = wfGetDB( DB_MASTER );
1666 - # Get current config
1667 - $row = $dbw->selectRow( 'flaggedpage_config',
1668 - array( 'fpc_select', 'fpc_override', 'fpc_expiry' ),
1669 - array( 'fpc_page_id' => $this->page->getArticleID() ),
1670 - __METHOD__ );
1671 - # If setting to site default values, erase the row if there is one...
1672 - if( $row && $this->select != $wgFlaggedRevsPrecedence && $this->override == $wgFlaggedRevsOverride ) {
1673 - $reset = true;
1674 - $dbw->delete( 'flaggedpage_config',
1675 - array( 'fpc_page_id' => $this->page->getArticleID() ),
1676 - __METHOD__ );
1677 - $changed = ($dbw->affectedRows() != 0); // did this do anything?
1678 - # Otherwise, add a row unless we are just setting it as the site default, or it is the same the current one...
1679 - } else if( $this->select !=0 || $this->override !=$wgFlaggedRevsOverride ) {
1680 - if( $row->fpc_select != $this->select || $row->fpc_override != $this->override || $row->fpc_expiry !== $expiry ) {
1681 - $changed = true;
1682 - $dbw->replace( 'flaggedpage_config',
1683 - array( 'PRIMARY' ),
1684 - array( 'fpc_page_id' => $this->page->getArticleID(),
1685 - 'fpc_select' => $this->select,
1686 - 'fpc_override' => $this->override,
1687 - 'fpc_expiry' => $expiry ),
1688 - __METHOD__ );
1689 - }
1690 - }
1691 -
1692 - # Log if changed
1693 - # @FIXME: do this better
1694 - if( $changed ) {
1695 - global $wgContLang;
1696 -
1697 - $log = new LogPage( 'stable' );
1698 - # ID, accuracy, depth, style
1699 - $set = array();
1700 - $set[] = wfMsg( "stabilization-sel-short" ) . ": " .
1701 - wfMsg("stabilization-sel-short-{$this->select}");
1702 - $set[] = wfMsg( "stabilization-def-short" ) . ": " .
1703 - wfMsg("stabilization-def-short-{$this->override}");
1704 - $settings = '[' . implode(', ',$set). ']';
1705 -
1706 - $comment = '';
1707 - # Append comment with settings (other than for resets)
1708 - if( !$reset ) {
1709 - $comment = $this->comment ? "{$this->comment} $settings" : "$settings";
1710 -
1711 - $encodedExpiry = Block::encodeExpiry($expiry, $dbw );
1712 - if( $encodedExpiry != 'infinity' ) {
1713 - $expiry_description = ' (' . wfMsgForContent( 'stabilize-expiring',
1714 - $wgContLang->timeanddate($expiry, false, false) ) . ')';
1715 - $comment .= "$expiry_description";
1716 - }
1717 - }
1718 -
1719 - if( $reset ) {
1720 - $log->addEntry( 'reset', $this->page, $comment );
1721 - } else {
1722 - $log->addEntry( 'config', $this->page, $comment );
1723 - }
1724 - }
1725 -
1726 - # Update the links tables as the stable version may now be the default page...
1727 - FlaggedRevs::titleLinksUpdate( $this->page );
1728 -
1729 - if( $this->watchThis ) {
1730 - $wgUser->addWatch( $this->page );
1731 - } else {
1732 - $wgUser->removeWatch( $this->page );
1733 - }
1734 -
1735 - $wgOut->redirect( $this->page->getFullUrl() );
1736 -
1737 - return true;
1738 - }
1739 -}
1740 -
1741 -class QualityOversight extends SpecialPage
1742 -{
1743 - function __construct() {
1744 - SpecialPage::SpecialPage( 'QualityOversight' );
1745 - }
1746 -
1747 - function execute( $par ) {
1748 - global $wgOut, $wgUser, $wgFlaggedRevsOversightAge;
1749 - $this->setHeaders();
1750 - $wgOut->addHTML( wfMsgExt('qualityoversight-list', array('parse') ) );
1751 - # Create a LogPager item to get the results and a LogEventsList item to format them...
1752 - $dbr = wfGetDB( DB_SLAVE );
1753 - $cutoff = $dbr->addQuotes( $dbr->timestamp(time() - $wgFlaggedRevsOversightAge) );
1754 - $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
1755 - $pager = new LogPager( $loglist, 'review', '', '', '',
1756 - array('log_action' => array('approve2','unapprove2'), "log_timestamp > $cutoff" ) );
1757 - # Insert list
1758 - $logBody = $pager->getBody();
1759 - if( $logBody ) {
1760 - $wgOut->addHTML(
1761 - $pager->getNavigationBar() .
1762 - $loglist->beginLogEventsList() .
1763 - $logBody .
1764 - $loglist->endLogEventsList() .
1765 - $pager->getNavigationBar()
1766 - );
1767 - } else {
1768 - $wgOut->addWikiMsg( 'logempty' );
1769 - }
1770 - }
1771 -}
1772 -
1773 -class DepreciationOversight extends SpecialPage
1774 -{
1775 - function __construct() {
1776 - SpecialPage::SpecialPage( 'DepreciationOversight' );
1777 - }
1778 -
1779 - function execute( $par ) {
1780 - global $wgOut, $wgUser, $wgFlaggedRevsOversightAge;
1781 - $this->setHeaders();
1782 - $wgOut->addHTML( wfMsgExt('depreciationoversight-list', array('parse') ) );
1783 - # Create a LogPager item to get the results and a LogEventsList item to format them...
1784 - $dbr = wfGetDB( DB_SLAVE );
1785 - $cutoff = $dbr->addQuotes( $dbr->timestamp(time() - $wgFlaggedRevsOversightAge) );
1786 - $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
1787 - $pager = new LogPager( $loglist, 'review', '', '', '',
1788 - array('log_action' => array('unapprove','unapprove2'), "log_timestamp > $cutoff" ) );
1789 - # Insert list
1790 - $logBody = $pager->getBody();
1791 - if( $logBody ) {
1792 - $wgOut->addHTML(
1793 - $pager->getNavigationBar() .
1794 - $loglist->beginLogEventsList() .
1795 - $logBody .
1796 - $loglist->endLogEventsList() .
1797 - $pager->getNavigationBar()
1798 - );
1799 - } else {
1800 - $wgOut->addWikiMsg( 'logempty' );
1801 - }
1802 - }
1803 -}

Status & tagging log