Index: trunk/phase3/includes/Article.php |
— | — | @@ -1539,8 +1539,7 @@ |
1540 | 1540 | if ( $good ) { |
1541 | 1541 | # Invalidate cache of this article and all pages using this article |
1542 | 1542 | # as a template. Partly deferred. |
1543 | | - Article::onArticleEdit( $this->mTitle ); |
1544 | | - |
| 1543 | + Article::onArticleEdit( $this->mTitle, false ); // leave templatelinks for editUpdates() |
1545 | 1544 | # Update links tables, site stats, etc. |
1546 | 1545 | $this->editUpdates( $text, $summary, $isminor, $now, $revisionId, $changed ); |
1547 | 1546 | $dbw->commit(); |
— | — | @@ -1593,7 +1592,7 @@ |
1594 | 1593 | Article::onArticleCreate( $this->mTitle ); |
1595 | 1594 | |
1596 | 1595 | wfRunHooks( 'ArticleInsertComplete', array( &$this, &$user, $text, $summary, |
1597 | | - $flags & EDIT_MINOR, null, null, &$flags, $revision ) ); |
| 1596 | + $flags & EDIT_MINOR, null, null, &$flags, $revision ) ); |
1598 | 1597 | } |
1599 | 1598 | |
1600 | 1599 | if ( $good && !( $flags & EDIT_DEFER_UPDATES ) ) { |
— | — | @@ -2701,6 +2700,7 @@ |
2702 | 2701 | /** |
2703 | 2702 | * Do standard deferred updates after page edit. |
2704 | 2703 | * Update links tables, site stats, search index and message cache. |
| 2704 | + * Purges pages that include this page if the text was changed here. |
2705 | 2705 | * Every 100th edit, prune the recent changes table. |
2706 | 2706 | * |
2707 | 2707 | * @private |
— | — | @@ -2733,7 +2733,8 @@ |
2734 | 2734 | } |
2735 | 2735 | |
2736 | 2736 | # Update the links tables |
2737 | | - $u = new LinksUpdate( $this->mTitle, $editInfo->output ); |
| 2737 | + $u = new LinksUpdate( $this->mTitle, $editInfo->output, false ); |
| 2738 | + $u->setRecursiveTouch( $changed ); // refresh/invalidate including pages too |
2738 | 2739 | $u->doUpdate(); |
2739 | 2740 | |
2740 | 2741 | if( wfRunHooks( 'ArticleEditUpdatesDeleteFromRecentchanges', array( &$this ) ) ) { |
— | — | @@ -2879,7 +2880,8 @@ |
2880 | 2881 | |
2881 | 2882 | $r = "\n\t\t\t\t<div id=\"mw-{$infomsg}\">" . wfMsg( $infomsg, $td, $userlinks ) . "</div>\n" . |
2882 | 2883 | |
2883 | | - "\n\t\t\t\t<div id=\"mw-revision-nav\">" . $cdel . wfMsg( 'revision-nav', $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "</div>\n\t\t\t"; |
| 2884 | + "\n\t\t\t\t<div id=\"mw-revision-nav\">" . $cdel . wfMsg( 'revision-nav', $prevdiff, |
| 2885 | + $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "</div>\n\t\t\t"; |
2884 | 2886 | $wgOut->setSubtitle( $r ); |
2885 | 2887 | } |
2886 | 2888 | |
— | — | @@ -3101,8 +3103,8 @@ |
3102 | 3104 | * @param $title_obj a title object |
3103 | 3105 | */ |
3104 | 3106 | |
3105 | | - public static function onArticleCreate($title) { |
3106 | | - # The talk page isn't in the regular link tables, so we need to update manually: |
| 3107 | + public static function onArticleCreate( $title ) { |
| 3108 | + # Update existence markers on article/talk tabs... |
3107 | 3109 | if ( $title->isTalkPage() ) { |
3108 | 3110 | $other = $title->getSubjectPage(); |
3109 | 3111 | } else { |
— | — | @@ -3118,8 +3120,7 @@ |
3119 | 3121 | |
3120 | 3122 | public static function onArticleDelete( $title ) { |
3121 | 3123 | global $wgUseFileCache, $wgMessageCache; |
3122 | | - |
3123 | | - // Update existence markers on article/talk tabs... |
| 3124 | + # Update existence markers on article/talk tabs... |
3124 | 3125 | if( $title->isTalkPage() ) { |
3125 | 3126 | $other = $title->getSubjectPage(); |
3126 | 3127 | } else { |
— | — | @@ -3156,11 +3157,12 @@ |
3157 | 3158 | /** |
3158 | 3159 | * Purge caches on page update etc |
3159 | 3160 | */ |
3160 | | - static function onArticleEdit( $title ) { |
| 3161 | + public static function onArticleEdit( $title, $touchTemplates = true ) { |
3161 | 3162 | global $wgDeferredUpdateList, $wgUseFileCache; |
3162 | 3163 | |
3163 | 3164 | // Invalidate caches of articles which include this page |
3164 | | - $wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, 'templatelinks' ); |
| 3165 | + if( $touchTemplates ) |
| 3166 | + $wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, 'templatelinks' ); |
3165 | 3167 | |
3166 | 3168 | // Invalidate the caches of all pages which redirect here |
3167 | 3169 | $wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, 'redirect' ); |
Index: trunk/phase3/includes/LinksUpdate.php |
— | — | @@ -20,7 +20,8 @@ |
21 | 21 | $mProperties, //!< Map of arbitrary name to value |
22 | 22 | $mDb, //!< Database connection reference |
23 | 23 | $mOptions, //!< SELECT options to be used (array) |
24 | | - $mRecursive; //!< Whether to queue jobs for recursive updates |
| 24 | + $mRecursive, //!< Whether to queue jobs for recursive updates |
| 25 | + $mTouchTmplLinks; //!< Whether to queue HTMLCacheUpdate jobs IF recursive |
25 | 26 | /**@}}*/ |
26 | 27 | |
27 | 28 | /** |
— | — | @@ -67,14 +68,24 @@ |
68 | 69 | } |
69 | 70 | |
70 | 71 | $this->mRecursive = $recursive; |
| 72 | + $this->mTouchTmplLinks = false; |
71 | 73 | |
72 | 74 | wfRunHooks( 'LinksUpdateConstructed', array( &$this ) ); |
73 | 75 | } |
| 76 | + |
| 77 | + /** |
| 78 | + * Invalidate HTML cache of pages that include this page? |
| 79 | + */ |
| 80 | + public function setRecursiveTouch( $val ) { |
| 81 | + $this->mTouchTmplLinks = (bool)$val; |
| 82 | + if( $val ) // Cannot invalidate without queueRecursiveJobs() |
| 83 | + $this->mRecursive = true; |
| 84 | + } |
74 | 85 | |
75 | 86 | /** |
76 | 87 | * Update link tables with outgoing links from an updated article |
77 | 88 | */ |
78 | | - function doUpdate() { |
| 89 | + public function doUpdate() { |
79 | 90 | global $wgUseDumbLinkUpdate; |
80 | 91 | |
81 | 92 | wfRunHooks( 'LinksUpdate', array( &$this ) ); |
— | — | @@ -229,7 +240,11 @@ |
230 | 241 | 'end' => ( $id !== false ? $id - 1 : false ), |
231 | 242 | ); |
232 | 243 | $jobs[] = new RefreshLinksJob2( $this->mTitle, $params ); |
233 | | - |
| 244 | + # Hit page caches while we're at it if set to do so... |
| 245 | + if( $this->mTouchTmplLinks ) { |
| 246 | + $params['table'] = 'templatelinks'; |
| 247 | + $jobs[] = new HTMLCacheUpdateJob( $this->mTitle, $params ); |
| 248 | + } |
234 | 249 | $start = $id; |
235 | 250 | } while ( $start ); |
236 | 251 | |
Index: trunk/phase3/includes/Import.php |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | |
221 | 221 | } elseif( $changed ) { |
222 | 222 | wfDebug( __METHOD__ . ": running onArticleEdit\n" ); |
223 | | - Article::onArticleEdit( $this->title ); |
| 223 | + Article::onArticleEdit( $this->title, false ); // leave templatelinks for editUpdates() |
224 | 224 | |
225 | 225 | wfDebug( __METHOD__ . ": running edit updates\n" ); |
226 | 226 | $article->editUpdates( |