r80733 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80732‎ | r80733 | r80734 >
Date:23:56, 21 January 2011
Author:demon
Status:ok
Tags:
Comment:
MFT first round of FlaggedRevs fixes r78517, r78346, r78319, r78293, r78226, r78213, r78166, r78163, r78142, r78140, r78092, r78051, r78044, r78042, r78027
Modified paths:
  • /branches/REL1_17/extensions/FlaggedRevs (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/FlaggedRevision.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/client/flaggedrevs.css (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/client/flaggedrevs.js (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/language/UnreviewedPages.i18n.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php (modified) (history)
  • /branches/REL1_17/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.php
@@ -250,7 +250,7 @@
251251 $wgAvailableRights[] = 'stablesettings';
252252
253253 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
254 -$wgFlaggedRevStyleVersion = 83;
 254+$wgFlaggedRevStyleVersion = 84;
255255
256256 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
257257
Index: branches/REL1_17/extensions/FlaggedRevs/language/UnreviewedPages.i18n.php
@@ -15,7 +15,7 @@
1616 'unreviewed-diff' => 'review',
1717 'unreviewed-unwatched' => '(unwatched)',
1818 'unreviewed-watched' => '($1 active {{PLURAL:$1|user|users}} watching)',
19 - 'unreviewed-list' => 'This page lists content pages that have not been reviewed to the specified level.',
 19+ 'unreviewed-list' => 'This page lists content pages that have \'\'not\'\' been reviewed to the specified level.',
2020 'unreviewed-none' => 'There are currently no pages meeting these criteria',
2121 'unreviewed-viewing' => '(under review)',
2222 'unreviewed-hours' => '($1 {{PLURAL:$1|hour|hours}})',
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedArticle.php
@@ -131,8 +131,12 @@
132132 if ( !( $flags & FR_MASTER ) && $this->pendingRevs !== null ) {
133133 return $this->pendingRevs;
134134 }
 135+ $srev = $this->getStableRev( $flags );
 136+ if ( !$srev ) {
 137+ return 0; // none
 138+ }
135139 $count = null;
136 - $sRevId = $this->getStable( $flags );
 140+ $sRevId = $srev->getRevId();
137141 # Try the cache...
138142 $key = wfMemcKey( 'flaggedrevs', 'countPending', $this->getId() );
139143 if ( !( $flags & FR_MASTER ) ) {
@@ -149,11 +153,12 @@
150154 }
151155 # Otherwise, fetch result from DB as needed...
152156 if ( is_null( $count ) ) {
153 - $db = ( $flags & FR_MASTER )
154 - ? wfGetDB( DB_MASTER )
155 - : wfGetDB( DB_SLAVE );
 157+ $db = ( $flags & FR_MASTER ) ?
 158+ wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
 159+ $srevTS = $db->timestamp( $srev->getRevTimestamp() );
156160 $count = $db->selectField( 'revision', 'COUNT(*)',
157 - array( 'rev_page' => $this->getId(), 'rev_id > ' . (int)$sRevId ),
 161+ array( 'rev_page' => $this->getId(),
 162+ 'rev_timestamp > ' . $db->addQuotes( $srevTS ) ), // bug 15515
158163 __METHOD__ );
159164 # Save result to cache...
160165 $data = FlaggedRevs::makeMemcObj( "{$sRevId}-{$count}" );
@@ -210,6 +215,14 @@
211216 }
212217
213218 /**
 219+ * Are template/file changes and ONLY template/file changes pending?
 220+ * @return bool
 221+ */
 222+ public function onlyTemplatesOrFilesPending() {
 223+ return ( !$this->revsArePending() && !$this->stableVersionIsSynced() );
 224+ }
 225+
 226+ /**
214227 * Is this page less open than the site defaults?
215228 * @return bool
216229 */
@@ -262,21 +275,18 @@
263276 /**
264277 * Get the stable revision
265278 * @param int $flags
266 - * @return mixed (FlaggedRevision/false)
 279+ * @return mixed (FlaggedRevision/null)
267280 */
268281 public function getStableRev( $flags = 0 ) {
269282 # Cached results available?
270 - if ( !( $flags & FR_MASTER ) && $this->stableRev !== null ) {
 283+ if ( $this->stableRev == null || ( $flags & FR_MASTER ) ) {
 284+ $srev = FlaggedRevision::newFromStable( $this->getTitle(), $flags );
 285+ $this->stableRev = $srev ? $srev : false; // false => "found nothing"
 286+ }
 287+ if ( $this->stableRev ) {
271288 return $this->stableRev;
272289 }
273 - # Do we have one?
274 - $srev = FlaggedRevision::newFromStable( $this->getTitle(), $flags );
275 - if ( $srev ) {
276 - $this->stableRev = $srev;
277 - } else {
278 - $this->stableRev = false;
279 - }
280 - return $this->stableRev;
 290+ return null;
281291 }
282292
283293 /**
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -730,13 +730,13 @@
731731 );
732732 # Get the timestamp of the first edit after the stable version (if any)...
733733 $nextTimestamp = null;
734 - $revId = $rev->getId();
735 - if ( $latest != $revId ) {
736 - $timestamp = $rev->getTimestamp();
 734+ if ( $rev->getId() != $latest ) {
 735+ $timestamp = $dbw->timestamp( $rev->getTimestamp() );
737736 $nextEditTS = $dbw->selectField( 'revision',
738737 'rev_timestamp',
739 - array( 'rev_page' => $article->getId(),
740 - "rev_timestamp > " . $dbw->addQuotes( $dbw->timestamp( $timestamp ) ) ),
 738+ array(
 739+ 'rev_page' => $article->getId(),
 740+ "rev_timestamp > " . $dbw->addQuotes( $timestamp ) ),
741741 __METHOD__,
742742 array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 1 )
743743 );
@@ -748,10 +748,10 @@
749749 $dbw->replace( 'flaggedpages',
750750 array( 'fp_page_id' ),
751751 array(
752 - 'fp_stable' => $revId,
753 - 'fp_reviewed' => ( $latest == $revId ) ? 1 : 0,
 752+ 'fp_page_id' => $article->getId(),
 753+ 'fp_stable' => $rev->getId(),
 754+ 'fp_reviewed' => ( $nextTimestamp === null ) ? 1 : 0,
754755 'fp_quality' => ( $maxQuality === false ) ? null : $maxQuality,
755 - 'fp_page_id' => $article->getId(),
756756 'fp_pending_since' => $dbw->timestampOrNull( $nextTimestamp )
757757 ),
758758 __METHOD__
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevision.php
@@ -311,8 +311,8 @@
312312 'fr_img_sha1' => $this->getFileSha1()
313313 );
314314 # Update flagged revisions table
315 - $dbw->replace( 'flaggedrevs', array( array( 'fr_page_id', 'fr_rev_id' ) ),
316 - $revRow, __METHOD__ );
 315+ $dbw->replace( 'flaggedrevs',
 316+ array( array( 'fr_page_id', 'fr_rev_id' ) ), $revRow, __METHOD__ );
317317 # Clear out any previous garbage...
318318 $dbw->delete( 'flaggedtemplates',
319319 array( 'ft_rev_id' => $this->getRevId() ), __METHOD__ );
@@ -388,14 +388,23 @@
389389 }
390390
391391 /**
 392+ * Check if the corresponding revision is the current revision
 393+ * Note: here for convenience
 394+ * @return bool
 395+ */
 396+ public function revIsCurrent() {
 397+ $rev = $this->getRevision(); // corresponding revision
 398+ return ( $rev ? $rev->isCurrent() : false );
 399+ }
 400+
 401+ /**
392402 * Get timestamp of the corresponding revision
 403+ * Note: here for convenience
393404 * @return string revision timestamp in MW format
394405 */
395406 public function getRevTimestamp() {
396 - # Get corresponding revision
397 - $rev = $this->getRevision();
398 - $timestamp = $rev ? $rev->getTimestamp() : "0";
399 - return $timestamp;
 407+ $rev = $this->getRevision(); // corresponding revision
 408+ return ( $rev ? $rev->getTimestamp() : "0" );
400409 }
401410
402411 /**
Index: branches/REL1_17/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
@@ -41,6 +41,9 @@
4242 );
4343 $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link );
4444
 45+ # Add explanatory text
 46+ $wgOut->addWikiMsg( 'unreviewed-list' );
 47+ # Add form...
4548 $action = htmlspecialchars( $wgScript );
4649 $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
4750 '<fieldset><legend>' . wfMsg( 'unreviewed-legend' ) . '</legend>' .
@@ -77,10 +80,9 @@
7881 $wgOut->addHTML( wfMsg( 'perfcached' ) );
7982 }
8083 }
81 - $pager = new UnreviewedPagesPager( $this, $live, $namespace,
82 - !$hideRedirs, $category, $level );
 84+ $pager = new UnreviewedPagesPager(
 85+ $this, $live, $namespace, !$hideRedirs, $category, $level );
8386 if ( $pager->getNumRows() ) {
84 - $wgOut->addWikiMsg( 'unreviewed-list' );
8587 $wgOut->addHTML( $pager->getNavigationBar() );
8688 $wgOut->addHTML( $pager->getBody() );
8789 $wgOut->addHTML( $pager->getNavigationBar() );
Index: branches/REL1_17/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
@@ -30,9 +30,13 @@
3131 public function showForm() {
3232 global $wgOut, $wgScript;
3333
 34+ // Text to explain level select (if there are several levels)
 35+ if ( FlaggedRevs::qualityVersions() ) {
 36+ $wgOut->addWikiMsg( 'reviewedpages-list' );
 37+ }
3438 $form = Xml::openElement( 'form',
3539 array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) );
36 - $form .= "<fieldset><legend>" . wfMsg( 'reviewedpages-leg' ) . "</legend>\n";
 40+ $form .= "<fieldset><legend>" . wfMsgHtml( 'reviewedpages-leg' ) . "</legend>\n";
3741
3842 // show/hide links
3943 $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
@@ -63,16 +67,12 @@
6468 }
6569
6670 protected function showPageList() {
67 - global $wgOut, $wgLang;
 71+ global $wgOut;
6872
6973 $pager = new ReviewedPagesPager( $this, array(), $this->type,
7074 $this->namespace, $this->hideRedirs );
7175 $num = $pager->getNumRows();
7276 if ( $num ) {
73 - // Text to explain level select (if there are several levels)
74 - if ( FlaggedRevs::qualityVersions() ) {
75 - $wgOut->addWikiMsg( 'reviewedpages-list', $wgLang->formatNum( $num ) );
76 - }
7777 $wgOut->addHTML( $pager->getNavigationBar() );
7878 $wgOut->addHTML( $pager->getBody() );
7979 $wgOut->addHTML( $pager->getNavigationBar() );
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -45,9 +45,11 @@
4646 */
4747 protected static function injectStyleAndJS() {
4848 global $wgOut, $wgUser, $wgFlaggedRevStyleVersion;
49 - if ( $wgOut->hasHeadItem( 'FlaggedRevs' ) ) {
 49+ static $loadedModules = false;
 50+ if ( $loadedModules ) {
5051 return true; # Don't double-load
5152 }
 53+ $loadedModules = true;
5254 $fa = FlaggedArticleView::globalArticleInstance();
5355 # Try to only add to relevant pages
5456 if ( !$fa || !$fa->isReviewable() ) {
@@ -58,8 +60,7 @@
5961 $encCssFile = htmlspecialchars( "$stylePath/flaggedrevs.css?$wgFlaggedRevStyleVersion" );
6062 $encJsFile = htmlspecialchars( "$stylePath/flaggedrevs.js?$wgFlaggedRevStyleVersion" );
6163 # Add CSS file
62 - $linkedStyle = Html::linkedStyle( $encCssFile );
63 - $wgOut->addHeadItem( 'FlaggedRevs', $linkedStyle );
 64+ $wgOut->addExtensionStyle( $encCssFile );
6465 # Add main JS file
6566 $wgOut->includeJQuery();
6667 $wgOut->addScriptFile( $encJsFile );
@@ -1609,6 +1610,7 @@
16101611 # Highlight unchecked content
16111612 $queryInfo['tables'][] = 'flaggedpages';
16121613 $queryInfo['fields'][] = 'fp_stable';
 1614+ $queryInfo['fields'][] = 'fp_pending_since';
16131615 $queryInfo['join_conds']['flaggedpages'] = array( 'LEFT JOIN', "fp_page_id = rev_page" );
16141616 return true;
16151617 }
@@ -1618,9 +1620,9 @@
16191621 ) {
16201622 $tables[] = 'flaggedpages';
16211623 $join_conds['flaggedpages'] = array( 'LEFT JOIN', 'fp_page_id = rc_cur_id' );
1622 - if( is_array( $select ) ) {
1623 - $dbr = wfGetDB( DB_SLAVE );
1624 - $select[] = $dbr->tableName( 'flaggedpages' ) . '.*';
 1624+ if ( is_array( $select ) ) { // RCL
 1625+ $select[] = 'fp_stable';
 1626+ $select[] = 'fp_pending_since';
16251627 }
16261628 return true;
16271629 }
@@ -1631,6 +1633,7 @@
16321634 global $wgUser;
16331635 if ( $wgUser->isAllowed( 'review' ) ) {
16341636 $fields[] = 'fp_stable';
 1637+ $fields[] = 'fp_pending_since';
16351638 $tables[] = 'flaggedpages';
16361639 $join_conds['flaggedpages'] = array( 'LEFT JOIN', 'fp_page_id = rc_cur_id' );
16371640 }
@@ -1644,7 +1647,10 @@
16451648 }
16461649 # Fetch and process cache the stable revision
16471650 if ( !isset( $history->fr_stableRevId ) ) {
1648 - $history->fr_stableRevId = $fa->getStable();
 1651+ $srev = $fa->getStableRev();
 1652+ $history->fr_stableRevId = $srev ? $srev->getRevId() : null;
 1653+ $history->fr_stableRevUTS = $srev ? // bug 15515
 1654+ wfTimestamp( TS_UNIX, $srev->getRevTimestamp() ) : null;
16491655 $history->fr_pendingRevs = false;
16501656 }
16511657 if ( !$history->fr_stableRevId ) {
@@ -1654,7 +1660,7 @@
16551661 $revId = (int)$row->rev_id;
16561662 // Pending revision: highlight and add diff link
16571663 $link = $class = '';
1658 - if ( $revId > $history->fr_stableRevId ) {
 1664+ if ( wfTimestamp( TS_UNIX, $row->rev_timestamp ) > $history->fr_stableRevUTS ) {
16591665 $class = 'flaggedrevs-pending';
16601666 $link = wfMsgExt( 'revreview-hist-pending-difflink', 'parseinline',
16611667 $title->getPrefixedText(), $history->fr_stableRevId, $revId );
@@ -1742,7 +1748,9 @@
17431749 } elseif ( isset( $row->fr_quality ) ) {
17441750 $ret = '<span class="' . FlaggedRevsXML::getQualityColor( $row->fr_quality ) .
17451751 '">' . $ret . '</span>';
1746 - } elseif ( isset( $row->fp_stable ) && $row->rev_id > $row->fp_stable ) {
 1752+ } elseif ( isset( $row->fp_pending_since )
 1753+ && $row->rev_timestamp >= $row->fp_pending_since ) // bug 15515
 1754+ {
17471755 $ret = '<span class="flaggedrevs-pending">' . $ret . '</span>';
17481756 } elseif ( !isset( $row->fp_stable ) ) {
17491757 $ret = '<span class="flaggedrevs-unreviewed">' . $ret . '</span>';
@@ -1754,7 +1762,7 @@
17551763 global $wgUser;
17561764 $title = $rc->getTitle(); // convenience
17571765 if ( !FlaggedRevs::inReviewNamespace( $title )
1758 - || empty( $rc->mAttribs['rc_this_oldid'] )
 1766+ || empty( $rc->mAttribs['rc_this_oldid'] ) // rev, not log
17591767 || !array_key_exists( 'fp_stable', $rc->mAttribs ) )
17601768 {
17611769 return true; // confirm that page is in reviewable namespace
@@ -1768,8 +1776,8 @@
17691777 $rlink = wfMsgHtml( 'revreview-unreviewedpage' );
17701778 $css = 'flaggedrevs-unreviewed';
17711779 }
1772 - // page is reviewed and has pending edits
1773 - } elseif ( $rc->mAttribs['rc_this_oldid'] > $rc->mAttribs['fp_stable'] ) {
 1780+ // page is reviewed and has pending edits (use timestamps; bug 15515)
 1781+ } elseif ( $rc->mAttribs['rc_timestamp'] > $rc->mAttribs['fp_pending_since'] ) {
17741782 $rlink = $list->skin->link(
17751783 $title,
17761784 wfMsgHtml( 'revreview-reviewlink' ),
@@ -1822,7 +1830,7 @@
18231831 return true; // nothing to do
18241832 }
18251833 $view = FlaggedArticleView::singleton();
1826 - $view->addCustomContentHtml( $out );
 1834+ $view->addCustomContentHtml( $out, $diffEngine->getNewid() );
18271835 return false;
18281836 }
18291837
@@ -2076,53 +2084,61 @@
20772085 return true;
20782086 }
20792087
2080 - public static function addSchemaUpdates() {
2081 - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables;
 2088+ public static function addSchemaUpdates( DatabaseUpdater $du ) {
 2089+ global $wgDBtype;
20822090 $base = dirname( __FILE__ );
20832091 if ( $wgDBtype == 'mysql' ) {
20842092 // Initial install tables (current schema)
2085 - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" );
 2093+ $du->addExtensionUpdate( array( 'addTable',
 2094+ 'flaggedrevs', "$base/FlaggedRevs.sql", true ) );
20862095 // Updates (in order)...
2087 - $wgExtNewFields[] = array( 'flaggedpage_config',
2088 - 'fpc_expiry', "$base/mysql/patch-fpc_expiry.sql" );
2089 - $wgExtNewIndexes[] = array( 'flaggedpage_config',
2090 - 'fpc_expiry', "$base/mysql/patch-expiry-index.sql" );
2091 - $wgExtNewTables[] = array( 'flaggedrevs_promote',
2092 - "$base/mysql/patch-flaggedrevs_promote.sql" );
2093 - $wgExtNewTables[] = array( 'flaggedpages', "$base/mysql/patch-flaggedpages.sql" );
2094 - $wgExtNewFields[] = array( 'flaggedrevs',
2095 - 'fr_img_name', "$base/mysql/patch-fr_img_name.sql" );
2096 - $wgExtNewTables[] = array( 'flaggedrevs_tracking',
2097 - "$base/mysql/patch-flaggedrevs_tracking.sql" );
2098 - $wgExtNewFields[] = array( 'flaggedpages', 'fp_pending_since',
2099 - "$base/mysql/patch-fp_pending_since.sql" );
2100 - $wgExtNewFields[] = array( 'flaggedpage_config', 'fpc_level',
2101 - "$base/mysql/patch-fpc_level.sql" );
2102 - $wgExtNewTables[] = array( 'flaggedpage_pending',
2103 - "$base/mysql/patch-flaggedpage_pending.sql" );
2104 - $wgExtNewTables[] = array( 'flaggedrevs_stats',
2105 - "$base/mysql/patch-flaggedrevs_stats.sql" );
 2096+ $du->addExtensionUpdate( array( 'addField',
 2097+ 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-fpc_expiry.sql", true ) );
 2098+ $du->addExtensionUpdate( array( 'addIndex',
 2099+ 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-expiry-index.sql", true ) );
 2100+ $du->addExtensionUpdate( array( 'addTable',
 2101+ 'flaggedrevs_promote', "$base/mysql/patch-flaggedrevs_promote.sql", true ) );
 2102+ $du->addExtensionUpdate( array( 'addTable',
 2103+ 'flaggedpages', "$base/mysql/patch-flaggedpages.sql", true ) );
 2104+ $du->addExtensionUpdate( array( 'addField',
 2105+ 'flaggedrevs', 'fr_img_name', "$base/mysql/patch-fr_img_name.sql", true ) );
 2106+ $du->addExtensionUpdate( array( 'addTable',
 2107+ 'flaggedrevs_tracking', "$base/mysql/patch-flaggedrevs_tracking.sql", true ) );
 2108+ $du->addExtensionUpdate( array( 'addField',
 2109+ 'flaggedpages', 'fp_pending_since', "$base/mysql/patch-fp_pending_since.sql", true ) );
 2110+ $du->addExtensionUpdate( array( 'addField',
 2111+ 'flaggedpage_config', 'fpc_level', "$base/mysql/patch-fpc_level.sql", true ) );
 2112+ $du->addExtensionUpdate( array( 'addTable',
 2113+ 'flaggedpage_pending', "$base/mysql/patch-flaggedpage_pending.sql", true ) );
 2114+ $du->addExtensionUpdate( array( 'addTable',
 2115+ 'flaggedrevs_stats', "$base/mysql/patch-flaggedrevs_stats.sql", true ) );
21062116 } elseif ( $wgDBtype == 'postgres' ) {
21072117 // Initial install tables (current schema)
2108 - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" );
 2118+ $du->addExtensionUpdate( array( 'addTable',
 2119+ 'flaggedrevs', "$base/FlaggedRevs.pg.sql", true ) );
21092120 // Updates (in order)...
2110 - $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" );
2111 - $wgExtNewIndexes[] = array( 'flaggedpage_config',
2112 - 'fpc_expiry', "$base/postgres/patch-expiry-index.sql" );
2113 - $wgExtNewTables[] = array( 'flaggedrevs_promote',
2114 - "$base/postgres/patch-flaggedrevs_promote.sql" );
2115 - $wgExtNewTables[] = array( 'flaggedpages', "$base/postgres/patch-flaggedpages.sql" );
2116 - $wgExtNewIndexes[] = array( 'flaggedrevs', 'fr_img_sha1',
2117 - "$base/postgres/patch-fr_img_name.sql" );
2118 - $wgExtNewTables[] = array( 'flaggedrevs_tracking',
2119 - "$base/postgres/patch-flaggedrevs_tracking.sql" );
2120 - $wgExtNewIndexes[] = array( 'flaggedpages', 'fp_pending_since',
2121 - "$base/postgres/patch-fp_pending_since.sql" );
2122 - $wgExtPGNewFields[] = array( 'flaggedpage_config', 'fpc_level', "TEXT NULL" );
2123 - $wgExtNewTables[] = array( 'flaggedpage_pending',
2124 - "$base/postgres/patch-flaggedpage_pending.sql" );
 2121+ $du->addExtensionUpdate( array( 'addField',
 2122+ 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ) );
 2123+ $du->addExtensionUpdate( array( 'addIndex',
 2124+ 'flaggedpage_config', 'fpc_expiry', "$base/postgres/patch-expiry-index.sql", true ) );
 2125+ $du->addExtensionUpdate( array( 'addTable',
 2126+ 'flaggedrevs_promote', "$base/postgres/patch-flaggedrevs_promote.sql", true ) );
 2127+ $du->addExtensionUpdate( array( 'addTable',
 2128+ 'flaggedpages', "$base/postgres/patch-flaggedpages.sql", true ) );
 2129+ $du->addExtensionUpdate( array( 'addIndex',
 2130+ 'flaggedrevs', 'fr_img_sha1', "$base/postgres/patch-fr_img_name.sql", true ) );
 2131+ $du->addExtensionUpdate( array( 'addTable',
 2132+ 'flaggedrevs_tracking', "$base/postgres/patch-flaggedrevs_tracking.sql", true ) );
 2133+ $du->addExtensionUpdate( array( 'addIndex',
 2134+ 'flaggedpages', 'fp_pending_since', "$base/postgres/patch-fp_pending_since.sql", true ) );
 2135+ $du->addExtensionUpdate( array( 'addField',
 2136+ 'flaggedpage_config', 'fpc_level', "TEXT NULL" ) );
 2137+ $du->addExtensionUpdate( array( 'addTable',
 2138+ 'flaggedpage_pending', "$base/postgres/patch-flaggedpage_pending.sql", true ) );
 2139+ // @TODO: PG stats table???
21252140 } elseif ( $wgDBtype == 'sqlite' ) {
2126 - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" );
 2141+ $du->addExtensionUpdate( array( 'addTable',
 2142+ 'flaggedrevs', "$base/FlaggedRevs.sql", true ) );
21272143 }
21282144 return true;
21292145 }
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -1185,10 +1185,20 @@
11861186 // We are looking a the stable version or an old reviewed one
11871187 $tabs['read']['class'] = 'selected';
11881188 } elseif ( self::isViewAction( $action ) ) {
1189 - // Are we looking at a draft/current revision?
1190 - // Note: there may *just* be template/file changes.
1191 - if ( $wgOut->getRevisionId() >= $srev->getRevId() ) {
 1189+ $ts = null;
 1190+ if ( $wgOut->getRevisionId() ) { // @TODO: avoid same query in Skin.php
 1191+ $ts = ( $wgOut->getRevisionId() == $this->article->getLatest() )
 1192+ ? $this->article->getTimestamp() // skip query
 1193+ : Revision::getTimestampFromId( $title, $wgOut->getRevisionId() );
 1194+ }
 1195+ // Are we looking at a pending revision?
 1196+ if ( $ts > $srev->getRevTimestamp() ) { // bug 15515
11921197 $tabs['draft']['class'] .= ' selected';
 1198+ // Are there *just* pending template/file changes.
 1199+ } elseif ( $this->article->onlyTemplatesOrFilesPending()
 1200+ && $wgOut->getRevisionId() == $this->article->getStable() )
 1201+ {
 1202+ $tabs['draft']['class'] .= ' selected';
11931203 // Otherwise, fallback to regular tab behavior
11941204 } else {
11951205 $tabs['read']['class'] = 'selected';
@@ -1437,43 +1447,43 @@
14381448 * Add [checked version] and such to left and right side of diff
14391449 */
14401450 protected static function diffReviewMarkers( FlaggedArticle $article, $oldRev, $newRev ) {
1441 - $form = '';
1442 -
 1451+ $table = '';
14431452 $srev = $article->getStableRev();
1444 - $stableId = $srev ? $srev->getRevId() : 0;
14451453 # Diff between two revisions
14461454 if ( $oldRev && $newRev ) {
1447 - list( $msg, $class ) = self::getDiffRevMsgAndClass( $oldRev, $stableId );
1448 - $form .= "<table class='fr-diff-ratings'><tr>";
1449 - $form .= "<td width='50%' align='center'>";
1450 - $form .= "<span class='$class'>[" .
 1455+ list( $msg, $class ) = self::getDiffRevMsgAndClass( $oldRev, $srev );
 1456+ $table .= "<table class='fr-diff-ratings'><tr>";
 1457+ $table .= "<td width='50%' align='center'>";
 1458+ $table .= "<span class='$class'>[" .
14511459 wfMsgHtml( $msg ) . "]</span>";
14521460
1453 - list( $msg, $class ) = self::getDiffRevMsgAndClass( $newRev, $stableId );
1454 - $form .= "</td><td width='50%' align='center'>";
1455 - $form .= "<span class='$class'>[" .
 1461+ list( $msg, $class ) = self::getDiffRevMsgAndClass( $newRev, $srev );
 1462+ $table .= "</td><td width='50%' align='center'>";
 1463+ $table .= "<span class='$class'>[" .
14561464 wfMsgHtml( $msg ) . "]</span>";
14571465
1458 - $form .= "</td></tr></table>\n";
 1466+ $table .= "</td></tr></table>\n";
14591467 # New page "diffs" - just one rev
14601468 } elseif ( $newRev ) {
1461 - list( $msg, $class ) = self::getDiffRevMsgAndClass( $newRev, $stableId );
1462 - $form .= "<table class='fr-diff-ratings'>";
1463 - $form .= "<tr><td align='center'><span class='$class'>";
1464 - $form .= '[' . wfMsgHtml( $msg ) . ']';
1465 - $form .= "</span></td></tr></table>\n";
 1469+ list( $msg, $class ) = self::getDiffRevMsgAndClass( $newRev, $srev );
 1470+ $table .= "<table class='fr-diff-ratings'>";
 1471+ $table .= "<tr><td align='center'><span class='$class'>";
 1472+ $table .= '[' . wfMsgHtml( $msg ) . ']';
 1473+ $table .= "</span></td></tr></table>\n";
14661474 }
1467 - return $form;
 1475+ return $table;
14681476 }
14691477
1470 - protected static function getDiffRevMsgAndClass( Revision $rev, $stableId ) {
 1478+ protected static function getDiffRevMsgAndClass(
 1479+ Revision $rev, FlaggedRevision $srev = null
 1480+ ) {
14711481 $tier = FlaggedRevs::getRevQuality( $rev->getPage(), $rev->getId() );
14721482 if ( $tier !== false ) {
14731483 $msg = $tier
14741484 ? 'revreview-hist-quality'
14751485 : 'revreview-hist-basic';
14761486 } else {
1477 - $msg = ( $stableId && $rev->getId() > $stableId )
 1487+ $msg = ( $srev && $rev->getTimestamp() > $srev->getRevTimestamp() ) // bug 15515
14781488 ? 'revreview-hist-pending'
14791489 : 'revreview-hist-draft';
14801490 }
@@ -1555,7 +1565,7 @@
15561566 return ( $srev && $oldRev && $newRev
15571567 && $oldRev->getPage() == $newRev->getPage() // no multipage diffs
15581568 && $oldRev->getId() == $srev->getRevId()
1559 - && $newRev->getTimestamp() >= $oldRev->getTimestamp()
 1569+ && $newRev->getTimestamp() >= $oldRev->getTimestamp() // no backwards diffs
15601570 );
15611571 }
15621572
@@ -1810,12 +1820,12 @@
18111821 * to the specific revision. This will be replaced with article content
18121822 * using javascript and an api call.
18131823 */
1814 - public function addCustomContentHtml( OutputPage $out ) {
 1824+ public function addCustomContentHtml( OutputPage $out, $newRevId ) {
18151825 $this->load();
1816 - if ( $out->getRevisionId() ) {
 1826+ if ( $newRevId ) {
18171827 $out->addHTML( "<div id='mw-fr-revisioncontents'><span class='plainlinks'>" );
18181828 $out->addWikiMsg( 'revcontents-getcontents',
1819 - $this->article->getTitle()->getPrefixedDBKey(), $out->getRevisionId() );
 1829+ $this->article->getTitle()->getPrefixedDBKey(), $newRevId );
18201830 $out->addHTML( "</span></div>" );
18211831 }
18221832 }
Index: branches/REL1_17/extensions/FlaggedRevs/client/flaggedrevs.css
@@ -342,3 +342,9 @@
343343 margin-top: -1.3em;
344344 float: left;
345345 }
 346+
 347+div.langlinks {
 348+ margin-top: 1em;
 349+ padding: 5px;
 350+ border: 1px solid #aaa;
 351+}
Index: branches/REL1_17/extensions/FlaggedRevs/client/flaggedrevs.js
@@ -215,7 +215,7 @@
216216 }
217217 languageshtml = jQuery(result).find("languageshtml");
218218 if ( languageshtml && languageshtml.text() ) {
219 - contentsDiv.innerHTML += languageshtml.text();
 219+ contentsDiv.innerHTML += "<div class='langlinks' >" + languageshtml.text() + "</div>";
220220 }
221221
222222 },
Property changes on: branches/REL1_17/extensions/FlaggedRevs
___________________________________________________________________
Modified: svn:mergeinfo
223223 Merged /trunk/extensions/FlaggedRevs:r78027,78042,78044,78051,78092,78140,78142,78163,78166,78213,78226,78293,78319,78346,78517

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78027Fix for bug 26128. Also needs r78023 and r78018pdhanda22:47, 7 December 2010
r78042Converted addSchemaUpdates to new formataaron03:41, 8 December 2010
r78044* (bug 15515) Fixed history highlighting and getPendingRevCount() to handle t...aaron05:17, 8 December 2010
r78051*(bug 15515) Fixed addToContribsLine() and addDraftTab() query w.r.t page imp...aaron07:31, 8 December 2010
r78092Improved getDiffRevMsgAndClass() for bug 15515aaron19:42, 8 December 2010
r78140* Made addToRCQuery() more selective for RCL. The RC hook should really requi...aaron21:28, 9 December 2010
r78142Removed old addToRCQuery cruftaaron21:40, 9 December 2010
r78163Follow-up r78027: Fixed injectStyleAndJS() check to avoid adding css/js twiceaaron01:01, 10 December 2010
r78166Cleanup return type for getStableRev() given r78092aaron03:23, 10 December 2010
r78213After r78212, it is safer to get the revision id from the DifferenceEngine ob...pdhanda23:00, 10 December 2010
r78226Fix for r78042: add "true" after paths since they are full path and not relat...ialex18:42, 11 December 2010
r78293fp_reviewed consistency tweaks and minor code cleanupaaron08:43, 13 December 2010
r78319Used accessor method instead of raw field. Follow up to r78213pdhanda19:57, 13 December 2010
r78346Follow up to r77897. Added some style to language links.pdhanda00:01, 14 December 2010
r78517Made explanatory special page text be consistently above the formaaron22:11, 16 December 2010

Status & tagging log