r22006 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22005‎ | r22006 | r22007 >
Date:20:17, 8 May 2007
Author:aaron
Status:old
Tags:
Comment:
*modify SQL query
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -481,11 +481,12 @@
482482 */
483483 public static function updatePageCache( $article, $parserOutput=NULL ) {
484484 global $wgUser, $parserMemc, $wgFlaggedRevsExpire;
485 - // Update the cache...
486 - $article->mTitle->invalidateCache();
487485 // Make sure it is valid
488486 if ( is_null($parserOutput) || !$article )
489487 return false;
 488+ // Update the cache...
 489+ $article->mTitle->invalidateCache();
 490+
490491 $key = 'sv-' . ParserCache::getKey( $article, $wgUser );
491492 // Add cache mark to HTML
492493 $now = wfTimestampNow();
@@ -518,7 +519,7 @@
519520 }
520521
521522 function extraLinksUpdate( &$article ) {
522 - $fname = 'FlaggedRevs::doIncrementalUpdate';
 523+ $fname = 'FlaggedRevs::extraLinksUpdate';
523524 wfProfileIn( $fname );
524525 # Check if this page has a stable version
525526 $sv = $this->getOverridingPageRev( $article );
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php
@@ -628,24 +628,25 @@
629629 return '<p>'.wfMsg("unreviewed-list")."</p><br />\n";
630630 }
631631
632 - function getSQLText( &$dbr, $namespace, $nonquality = false ) {
 632+ function getSQLText( &$dbr, $namespace, $includenonquality = false ) {
633633 global $wgContentNamespaces;
634634
635635 list( $page, $flaggedrevs ) = $dbr->tableNamesN( 'page', 'flaggedrevs' );
636636
637637 $ns = ($namespace !== null) ? "page_namespace=$namespace" : '1 = 1';
638 - $where = $nonquality ? '1 = 1' : 'fr_rev_id IS NULL';
 638+ $where = $includenonquality ? '1 = 1' : 'fr_rev_id IS NULL';
 639+ $having = $includenonquality ? '(MAX(fr_quality) IS NULL OR MAX(fr_quality) < 1)' : '1 = 1';
639640 $content = array();
640641 foreach( $wgContentNamespaces as $cns ) {
641642 $content[] = "page_namespace=$cns";
642643 }
643644 $content = implode(' OR ',$content);
644645 $sql =
645 - "SELECT page_namespace,page_title,page_len AS size, MAX(fr_quality) as quality, COUNT(*) as num
 646+ "SELECT page_namespace,page_title,page_len AS size
646647 FROM $page
647648 LEFT JOIN $flaggedrevs ON (fr_namespace = page_namespace AND fr_title = page_title)
648 - WHERE page_is_redirect=0 AND $ns AND ($where) AND ($content)
649 - GROUP BY page_id ";
 649+ WHERE page_is_redirect=0 AND $ns AND ($content) AND ($where)
 650+ GROUP BY page_id HAVING $having ";
650651 return $sql;
651652 }
652653
@@ -661,10 +662,6 @@
662663 function formatResult( $skin, $result ) {
663664 global $wgLang;
664665
665 - // If the best revision of the page is quality
666 - // then skip it...
667 - if ( $this->nonquality && $result->quality >= 1 )
668 - return false;
669666 $fname = 'UnreviewedPagesPage::formatResult';
670667 $title = Title::makeTitle( $result->page_namespace, $result->page_title );
671668 $link = $skin->makeKnownLinkObj( $title );