Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | $wgAvailableRights[] = 'stablesettings'; |
252 | 252 | |
253 | 253 | # Bump this number every time you change flaggedrevs.css/flaggedrevs.js |
254 | | -$wgFlaggedRevStyleVersion = 83; |
| 254 | +$wgFlaggedRevStyleVersion = 84; |
255 | 255 | |
256 | 256 | $wgExtensionFunctions[] = 'efLoadFlaggedRevs'; |
257 | 257 | |
Index: branches/REL1_17/extensions/FlaggedRevs/language/UnreviewedPages.i18n.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | 'unreviewed-diff' => 'review', |
17 | 17 | 'unreviewed-unwatched' => '(unwatched)', |
18 | 18 | '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.', |
20 | 20 | 'unreviewed-none' => 'There are currently no pages meeting these criteria', |
21 | 21 | 'unreviewed-viewing' => '(under review)', |
22 | 22 | 'unreviewed-hours' => '($1 {{PLURAL:$1|hour|hours}})', |
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -131,8 +131,12 @@ |
132 | 132 | if ( !( $flags & FR_MASTER ) && $this->pendingRevs !== null ) { |
133 | 133 | return $this->pendingRevs; |
134 | 134 | } |
| 135 | + $srev = $this->getStableRev( $flags ); |
| 136 | + if ( !$srev ) { |
| 137 | + return 0; // none |
| 138 | + } |
135 | 139 | $count = null; |
136 | | - $sRevId = $this->getStable( $flags ); |
| 140 | + $sRevId = $srev->getRevId(); |
137 | 141 | # Try the cache... |
138 | 142 | $key = wfMemcKey( 'flaggedrevs', 'countPending', $this->getId() ); |
139 | 143 | if ( !( $flags & FR_MASTER ) ) { |
— | — | @@ -149,11 +153,12 @@ |
150 | 154 | } |
151 | 155 | # Otherwise, fetch result from DB as needed... |
152 | 156 | 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() ); |
156 | 160 | $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 |
158 | 163 | __METHOD__ ); |
159 | 164 | # Save result to cache... |
160 | 165 | $data = FlaggedRevs::makeMemcObj( "{$sRevId}-{$count}" ); |
— | — | @@ -210,6 +215,14 @@ |
211 | 216 | } |
212 | 217 | |
213 | 218 | /** |
| 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 | + /** |
214 | 227 | * Is this page less open than the site defaults? |
215 | 228 | * @return bool |
216 | 229 | */ |
— | — | @@ -262,21 +275,18 @@ |
263 | 276 | /** |
264 | 277 | * Get the stable revision |
265 | 278 | * @param int $flags |
266 | | - * @return mixed (FlaggedRevision/false) |
| 279 | + * @return mixed (FlaggedRevision/null) |
267 | 280 | */ |
268 | 281 | public function getStableRev( $flags = 0 ) { |
269 | 282 | # 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 ) { |
271 | 288 | return $this->stableRev; |
272 | 289 | } |
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; |
281 | 291 | } |
282 | 292 | |
283 | 293 | /** |
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -730,13 +730,13 @@ |
731 | 731 | ); |
732 | 732 | # Get the timestamp of the first edit after the stable version (if any)... |
733 | 733 | $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() ); |
737 | 736 | $nextEditTS = $dbw->selectField( 'revision', |
738 | 737 | '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 ) ), |
741 | 741 | __METHOD__, |
742 | 742 | array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 1 ) |
743 | 743 | ); |
— | — | @@ -748,10 +748,10 @@ |
749 | 749 | $dbw->replace( 'flaggedpages', |
750 | 750 | array( 'fp_page_id' ), |
751 | 751 | 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, |
754 | 755 | 'fp_quality' => ( $maxQuality === false ) ? null : $maxQuality, |
755 | | - 'fp_page_id' => $article->getId(), |
756 | 756 | 'fp_pending_since' => $dbw->timestampOrNull( $nextTimestamp ) |
757 | 757 | ), |
758 | 758 | __METHOD__ |
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevision.php |
— | — | @@ -311,8 +311,8 @@ |
312 | 312 | 'fr_img_sha1' => $this->getFileSha1() |
313 | 313 | ); |
314 | 314 | # 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__ ); |
317 | 317 | # Clear out any previous garbage... |
318 | 318 | $dbw->delete( 'flaggedtemplates', |
319 | 319 | array( 'ft_rev_id' => $this->getRevId() ), __METHOD__ ); |
— | — | @@ -388,14 +388,23 @@ |
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
| 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 | + /** |
392 | 402 | * Get timestamp of the corresponding revision |
| 403 | + * Note: here for convenience |
393 | 404 | * @return string revision timestamp in MW format |
394 | 405 | */ |
395 | 406 | 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" ); |
400 | 409 | } |
401 | 410 | |
402 | 411 | /** |
Index: branches/REL1_17/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php |
— | — | @@ -41,6 +41,9 @@ |
42 | 42 | ); |
43 | 43 | $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link ); |
44 | 44 | |
| 45 | + # Add explanatory text |
| 46 | + $wgOut->addWikiMsg( 'unreviewed-list' ); |
| 47 | + # Add form... |
45 | 48 | $action = htmlspecialchars( $wgScript ); |
46 | 49 | $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" . |
47 | 50 | '<fieldset><legend>' . wfMsg( 'unreviewed-legend' ) . '</legend>' . |
— | — | @@ -77,10 +80,9 @@ |
78 | 81 | $wgOut->addHTML( wfMsg( 'perfcached' ) ); |
79 | 82 | } |
80 | 83 | } |
81 | | - $pager = new UnreviewedPagesPager( $this, $live, $namespace, |
82 | | - !$hideRedirs, $category, $level ); |
| 84 | + $pager = new UnreviewedPagesPager( |
| 85 | + $this, $live, $namespace, !$hideRedirs, $category, $level ); |
83 | 86 | if ( $pager->getNumRows() ) { |
84 | | - $wgOut->addWikiMsg( 'unreviewed-list' ); |
85 | 87 | $wgOut->addHTML( $pager->getNavigationBar() ); |
86 | 88 | $wgOut->addHTML( $pager->getBody() ); |
87 | 89 | $wgOut->addHTML( $pager->getNavigationBar() ); |
Index: branches/REL1_17/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php |
— | — | @@ -30,9 +30,13 @@ |
31 | 31 | public function showForm() { |
32 | 32 | global $wgOut, $wgScript; |
33 | 33 | |
| 34 | + // Text to explain level select (if there are several levels) |
| 35 | + if ( FlaggedRevs::qualityVersions() ) { |
| 36 | + $wgOut->addWikiMsg( 'reviewedpages-list' ); |
| 37 | + } |
34 | 38 | $form = Xml::openElement( 'form', |
35 | 39 | 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"; |
37 | 41 | |
38 | 42 | // show/hide links |
39 | 43 | $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) ); |
— | — | @@ -63,16 +67,12 @@ |
64 | 68 | } |
65 | 69 | |
66 | 70 | protected function showPageList() { |
67 | | - global $wgOut, $wgLang; |
| 71 | + global $wgOut; |
68 | 72 | |
69 | 73 | $pager = new ReviewedPagesPager( $this, array(), $this->type, |
70 | 74 | $this->namespace, $this->hideRedirs ); |
71 | 75 | $num = $pager->getNumRows(); |
72 | 76 | 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 | | - } |
77 | 77 | $wgOut->addHTML( $pager->getNavigationBar() ); |
78 | 78 | $wgOut->addHTML( $pager->getBody() ); |
79 | 79 | $wgOut->addHTML( $pager->getNavigationBar() ); |
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -45,9 +45,11 @@ |
46 | 46 | */ |
47 | 47 | protected static function injectStyleAndJS() { |
48 | 48 | global $wgOut, $wgUser, $wgFlaggedRevStyleVersion; |
49 | | - if ( $wgOut->hasHeadItem( 'FlaggedRevs' ) ) { |
| 49 | + static $loadedModules = false; |
| 50 | + if ( $loadedModules ) { |
50 | 51 | return true; # Don't double-load |
51 | 52 | } |
| 53 | + $loadedModules = true; |
52 | 54 | $fa = FlaggedArticleView::globalArticleInstance(); |
53 | 55 | # Try to only add to relevant pages |
54 | 56 | if ( !$fa || !$fa->isReviewable() ) { |
— | — | @@ -58,8 +60,7 @@ |
59 | 61 | $encCssFile = htmlspecialchars( "$stylePath/flaggedrevs.css?$wgFlaggedRevStyleVersion" ); |
60 | 62 | $encJsFile = htmlspecialchars( "$stylePath/flaggedrevs.js?$wgFlaggedRevStyleVersion" ); |
61 | 63 | # Add CSS file |
62 | | - $linkedStyle = Html::linkedStyle( $encCssFile ); |
63 | | - $wgOut->addHeadItem( 'FlaggedRevs', $linkedStyle ); |
| 64 | + $wgOut->addExtensionStyle( $encCssFile ); |
64 | 65 | # Add main JS file |
65 | 66 | $wgOut->includeJQuery(); |
66 | 67 | $wgOut->addScriptFile( $encJsFile ); |
— | — | @@ -1609,6 +1610,7 @@ |
1610 | 1611 | # Highlight unchecked content |
1611 | 1612 | $queryInfo['tables'][] = 'flaggedpages'; |
1612 | 1613 | $queryInfo['fields'][] = 'fp_stable'; |
| 1614 | + $queryInfo['fields'][] = 'fp_pending_since'; |
1613 | 1615 | $queryInfo['join_conds']['flaggedpages'] = array( 'LEFT JOIN', "fp_page_id = rev_page" ); |
1614 | 1616 | return true; |
1615 | 1617 | } |
— | — | @@ -1618,9 +1620,9 @@ |
1619 | 1621 | ) { |
1620 | 1622 | $tables[] = 'flaggedpages'; |
1621 | 1623 | $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'; |
1625 | 1627 | } |
1626 | 1628 | return true; |
1627 | 1629 | } |
— | — | @@ -1631,6 +1633,7 @@ |
1632 | 1634 | global $wgUser; |
1633 | 1635 | if ( $wgUser->isAllowed( 'review' ) ) { |
1634 | 1636 | $fields[] = 'fp_stable'; |
| 1637 | + $fields[] = 'fp_pending_since'; |
1635 | 1638 | $tables[] = 'flaggedpages'; |
1636 | 1639 | $join_conds['flaggedpages'] = array( 'LEFT JOIN', 'fp_page_id = rc_cur_id' ); |
1637 | 1640 | } |
— | — | @@ -1644,7 +1647,10 @@ |
1645 | 1648 | } |
1646 | 1649 | # Fetch and process cache the stable revision |
1647 | 1650 | 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; |
1649 | 1655 | $history->fr_pendingRevs = false; |
1650 | 1656 | } |
1651 | 1657 | if ( !$history->fr_stableRevId ) { |
— | — | @@ -1654,7 +1660,7 @@ |
1655 | 1661 | $revId = (int)$row->rev_id; |
1656 | 1662 | // Pending revision: highlight and add diff link |
1657 | 1663 | $link = $class = ''; |
1658 | | - if ( $revId > $history->fr_stableRevId ) { |
| 1664 | + if ( wfTimestamp( TS_UNIX, $row->rev_timestamp ) > $history->fr_stableRevUTS ) { |
1659 | 1665 | $class = 'flaggedrevs-pending'; |
1660 | 1666 | $link = wfMsgExt( 'revreview-hist-pending-difflink', 'parseinline', |
1661 | 1667 | $title->getPrefixedText(), $history->fr_stableRevId, $revId ); |
— | — | @@ -1742,7 +1748,9 @@ |
1743 | 1749 | } elseif ( isset( $row->fr_quality ) ) { |
1744 | 1750 | $ret = '<span class="' . FlaggedRevsXML::getQualityColor( $row->fr_quality ) . |
1745 | 1751 | '">' . $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 | + { |
1747 | 1755 | $ret = '<span class="flaggedrevs-pending">' . $ret . '</span>'; |
1748 | 1756 | } elseif ( !isset( $row->fp_stable ) ) { |
1749 | 1757 | $ret = '<span class="flaggedrevs-unreviewed">' . $ret . '</span>'; |
— | — | @@ -1754,7 +1762,7 @@ |
1755 | 1763 | global $wgUser; |
1756 | 1764 | $title = $rc->getTitle(); // convenience |
1757 | 1765 | if ( !FlaggedRevs::inReviewNamespace( $title ) |
1758 | | - || empty( $rc->mAttribs['rc_this_oldid'] ) |
| 1766 | + || empty( $rc->mAttribs['rc_this_oldid'] ) // rev, not log |
1759 | 1767 | || !array_key_exists( 'fp_stable', $rc->mAttribs ) ) |
1760 | 1768 | { |
1761 | 1769 | return true; // confirm that page is in reviewable namespace |
— | — | @@ -1768,8 +1776,8 @@ |
1769 | 1777 | $rlink = wfMsgHtml( 'revreview-unreviewedpage' ); |
1770 | 1778 | $css = 'flaggedrevs-unreviewed'; |
1771 | 1779 | } |
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'] ) { |
1774 | 1782 | $rlink = $list->skin->link( |
1775 | 1783 | $title, |
1776 | 1784 | wfMsgHtml( 'revreview-reviewlink' ), |
— | — | @@ -1822,7 +1830,7 @@ |
1823 | 1831 | return true; // nothing to do |
1824 | 1832 | } |
1825 | 1833 | $view = FlaggedArticleView::singleton(); |
1826 | | - $view->addCustomContentHtml( $out ); |
| 1834 | + $view->addCustomContentHtml( $out, $diffEngine->getNewid() ); |
1827 | 1835 | return false; |
1828 | 1836 | } |
1829 | 1837 | |
— | — | @@ -2076,53 +2084,61 @@ |
2077 | 2085 | return true; |
2078 | 2086 | } |
2079 | 2087 | |
2080 | | - public static function addSchemaUpdates() { |
2081 | | - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewIndexes, $wgExtNewTables; |
| 2088 | + public static function addSchemaUpdates( DatabaseUpdater $du ) { |
| 2089 | + global $wgDBtype; |
2082 | 2090 | $base = dirname( __FILE__ ); |
2083 | 2091 | if ( $wgDBtype == 'mysql' ) { |
2084 | 2092 | // Initial install tables (current schema) |
2085 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" ); |
| 2093 | + $du->addExtensionUpdate( array( 'addTable', |
| 2094 | + 'flaggedrevs', "$base/FlaggedRevs.sql", true ) ); |
2086 | 2095 | // 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 ) ); |
2106 | 2116 | } elseif ( $wgDBtype == 'postgres' ) { |
2107 | 2117 | // 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 ) ); |
2109 | 2120 | // 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??? |
2125 | 2140 | } elseif ( $wgDBtype == 'sqlite' ) { |
2126 | | - $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.sql" ); |
| 2141 | + $du->addExtensionUpdate( array( 'addTable', |
| 2142 | + 'flaggedrevs', "$base/FlaggedRevs.sql", true ) ); |
2127 | 2143 | } |
2128 | 2144 | return true; |
2129 | 2145 | } |
Index: branches/REL1_17/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -1185,10 +1185,20 @@ |
1186 | 1186 | // We are looking a the stable version or an old reviewed one |
1187 | 1187 | $tabs['read']['class'] = 'selected'; |
1188 | 1188 | } 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 |
1192 | 1197 | $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'; |
1193 | 1203 | // Otherwise, fallback to regular tab behavior |
1194 | 1204 | } else { |
1195 | 1205 | $tabs['read']['class'] = 'selected'; |
— | — | @@ -1437,43 +1447,43 @@ |
1438 | 1448 | * Add [checked version] and such to left and right side of diff |
1439 | 1449 | */ |
1440 | 1450 | protected static function diffReviewMarkers( FlaggedArticle $article, $oldRev, $newRev ) { |
1441 | | - $form = ''; |
1442 | | - |
| 1451 | + $table = ''; |
1443 | 1452 | $srev = $article->getStableRev(); |
1444 | | - $stableId = $srev ? $srev->getRevId() : 0; |
1445 | 1453 | # Diff between two revisions |
1446 | 1454 | 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'>[" . |
1451 | 1459 | wfMsgHtml( $msg ) . "]</span>"; |
1452 | 1460 | |
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'>[" . |
1456 | 1464 | wfMsgHtml( $msg ) . "]</span>"; |
1457 | 1465 | |
1458 | | - $form .= "</td></tr></table>\n"; |
| 1466 | + $table .= "</td></tr></table>\n"; |
1459 | 1467 | # New page "diffs" - just one rev |
1460 | 1468 | } 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"; |
1466 | 1474 | } |
1467 | | - return $form; |
| 1475 | + return $table; |
1468 | 1476 | } |
1469 | 1477 | |
1470 | | - protected static function getDiffRevMsgAndClass( Revision $rev, $stableId ) { |
| 1478 | + protected static function getDiffRevMsgAndClass( |
| 1479 | + Revision $rev, FlaggedRevision $srev = null |
| 1480 | + ) { |
1471 | 1481 | $tier = FlaggedRevs::getRevQuality( $rev->getPage(), $rev->getId() ); |
1472 | 1482 | if ( $tier !== false ) { |
1473 | 1483 | $msg = $tier |
1474 | 1484 | ? 'revreview-hist-quality' |
1475 | 1485 | : 'revreview-hist-basic'; |
1476 | 1486 | } else { |
1477 | | - $msg = ( $stableId && $rev->getId() > $stableId ) |
| 1487 | + $msg = ( $srev && $rev->getTimestamp() > $srev->getRevTimestamp() ) // bug 15515 |
1478 | 1488 | ? 'revreview-hist-pending' |
1479 | 1489 | : 'revreview-hist-draft'; |
1480 | 1490 | } |
— | — | @@ -1555,7 +1565,7 @@ |
1556 | 1566 | return ( $srev && $oldRev && $newRev |
1557 | 1567 | && $oldRev->getPage() == $newRev->getPage() // no multipage diffs |
1558 | 1568 | && $oldRev->getId() == $srev->getRevId() |
1559 | | - && $newRev->getTimestamp() >= $oldRev->getTimestamp() |
| 1569 | + && $newRev->getTimestamp() >= $oldRev->getTimestamp() // no backwards diffs |
1560 | 1570 | ); |
1561 | 1571 | } |
1562 | 1572 | |
— | — | @@ -1810,12 +1820,12 @@ |
1811 | 1821 | * to the specific revision. This will be replaced with article content |
1812 | 1822 | * using javascript and an api call. |
1813 | 1823 | */ |
1814 | | - public function addCustomContentHtml( OutputPage $out ) { |
| 1824 | + public function addCustomContentHtml( OutputPage $out, $newRevId ) { |
1815 | 1825 | $this->load(); |
1816 | | - if ( $out->getRevisionId() ) { |
| 1826 | + if ( $newRevId ) { |
1817 | 1827 | $out->addHTML( "<div id='mw-fr-revisioncontents'><span class='plainlinks'>" ); |
1818 | 1828 | $out->addWikiMsg( 'revcontents-getcontents', |
1819 | | - $this->article->getTitle()->getPrefixedDBKey(), $out->getRevisionId() ); |
| 1829 | + $this->article->getTitle()->getPrefixedDBKey(), $newRevId ); |
1820 | 1830 | $out->addHTML( "</span></div>" ); |
1821 | 1831 | } |
1822 | 1832 | } |
Index: branches/REL1_17/extensions/FlaggedRevs/client/flaggedrevs.css |
— | — | @@ -342,3 +342,9 @@ |
343 | 343 | margin-top: -1.3em; |
344 | 344 | float: left; |
345 | 345 | } |
| 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 @@ |
216 | 216 | } |
217 | 217 | languageshtml = jQuery(result).find("languageshtml"); |
218 | 218 | if ( languageshtml && languageshtml.text() ) { |
219 | | - contentsDiv.innerHTML += languageshtml.text(); |
| 219 | + contentsDiv.innerHTML += "<div class='langlinks' >" + languageshtml.text() + "</div>"; |
220 | 220 | } |
221 | 221 | |
222 | 222 | }, |
Property changes on: branches/REL1_17/extensions/FlaggedRevs |
___________________________________________________________________ |
Modified: svn:mergeinfo |
223 | 223 | Merged /trunk/extensions/FlaggedRevs:r78027,78042,78044,78051,78092,78140,78142,78163,78166,78213,78226,78293,78319,78346,78517 |