Index: branches/jhb/phase3/extensions/FlaggedRevs.php |
— | — | @@ -270,19 +270,16 @@ |
271 | 271 | $newbodytext = NULL; |
272 | 272 | # Try the stable cache for non-users |
273 | 273 | # Users have skin prefs and this caching won't work |
274 | | - if ( $wgUser->isAnon() ) { |
275 | | - $newbodytext = $this->getPageCache( $wgArticle ); |
276 | | - } |
| 274 | + $newbodytext = $this->getPageCache( $wgArticle ); |
277 | 275 | # If no cache is available, get the text and parse it |
278 | 276 | if ( is_null($newbodytext) ) { |
279 | 277 | $text = $this->getFlaggedRevText( $visible_id ); |
280 | 278 | # For anons, use standard prefs, for users, get theirs |
281 | | - $options = ( $wgUser->isAnon() ) ? new ParserOptions() : ParserOptions::newFromUser($wgUser); |
| 279 | + $options = ParserOptions::newFromUser($wgUser); |
282 | 280 | # Parsing this text is kind of funky... |
283 | 281 | $newbodytext = $this->parseStableText( $wgTitle, $text, $visible_id, $options ); |
284 | 282 | # Update the general cache for non-users |
285 | | - if ( $wgUser->isAnon() ) |
286 | | - $this->updatePageCache( $wgArticle, $newbodytext ); |
| 283 | + $this->updatePageCache( $wgArticle, $newbodytext ); |
287 | 284 | } |
288 | 285 | } |
289 | 286 | // Construct some tagging |
— | — | @@ -460,7 +457,7 @@ |
461 | 458 | } else if( $ontop ) { |
462 | 459 | $wgOut->addHTML( $form ); |
463 | 460 | } else { |
464 | | - $wgOut->addHTML( '<hr/>' . $form ); |
| 461 | + $wgOut->addHTML( $form ); |
465 | 462 | } |
466 | 463 | } |
467 | 464 | |
— | — | @@ -474,7 +471,7 @@ |
475 | 472 | $notes = ($breakline) ? '<hr/><br/>' : ''; |
476 | 473 | $notes .= '<div class="mw-warning plainlinks">'; |
477 | 474 | $notes .= wfMsgExt('revreview-note', array('parse'), User::whoIs( $row->fr_user ) ); |
478 | | - $notes .= $this->skin->formatComment( $row->fr_comment ) . "</div>"; |
| 475 | + $notes .= '<i>' . $this->skin->formatComment( $row->fr_comment ) . '</i></div>'; |
479 | 476 | $wgOut->addHTML( $notes ); |
480 | 477 | } |
481 | 478 | } |
— | — | @@ -707,16 +704,20 @@ |
708 | 705 | } |
709 | 706 | |
710 | 707 | function getPageCache( $article ) { |
| 708 | + global $wgUser; |
| 709 | + |
711 | 710 | wfProfileIn( __METHOD__ ); |
712 | 711 | |
713 | 712 | // Make sure it is valid |
714 | 713 | if ( !$article || !$article->getId() ) return NULL; |
| 714 | + $cachekey = ParserCache::getKey( $article, $wgUser ); |
| 715 | + |
715 | 716 | $db = wfGetDB( DB_SLAVE ); |
716 | 717 | // Replace the page cache if it is out of date |
717 | 718 | $result = $db->select( |
718 | 719 | array('flaggedcache'), |
719 | 720 | array('fc_cache'), |
720 | | - array('fc_page_id' => $article->getId(), 'fc_date >= ' . $article->getTouched() ), |
| 721 | + array('fc_key' => $cachekey, 'fc_date >= ' . $article->getTouched() ), |
721 | 722 | __METHOD__); |
722 | 723 | if ( $row = $db->fetchObject($result) ) { |
723 | 724 | return $row->fc_cache; |
— | — | @@ -725,19 +726,21 @@ |
726 | 727 | } |
727 | 728 | |
728 | 729 | function updatePageCache( $article, $value=NULL ) { |
| 730 | + global $wgUser; |
729 | 731 | wfProfileIn( __METHOD__ ); |
730 | 732 | |
731 | 733 | // Make sure it is valid |
732 | 734 | if ( is_null($value) || !$article || !$article->getId() ) return false; |
| 735 | + $cachekey = ParserCache::getKey( $article, $wgUser ); |
733 | 736 | // Add cache mark |
734 | 737 | $timestamp = wfTimestampNow(); |
735 | | - $value .= "\n<!-- Saved in stable version parser cache for page id #".$article->getId()." with timestamp $timestamp -->"; |
| 738 | + $value .= "\n<!-- Saved in stable version parser cache for key $cachekey with timestamp $timestamp -->"; |
736 | 739 | |
737 | 740 | $dbw = wfGetDB( DB_MASTER ); |
738 | 741 | // Replace the page cache if it is out of date |
739 | 742 | $dbw->replace('flaggedcache', |
740 | | - array('fc_page_id'), |
741 | | - array('fc_page_id' => $article->getId(), 'fc_cache' => $value, 'fc_date' => $timestamp), |
| 743 | + array('fc_key'), |
| 744 | + array('fc_key' => $cachekey, 'fc_cache' => $value, 'fc_date' => $timestamp), |
742 | 745 | __METHOD__); |
743 | 746 | |
744 | 747 | return true; |
Index: branches/jhb/phase3/extensions/FlaggedRevs.sql |
— | — | @@ -46,9 +46,9 @@ |
47 | 47 |
|
48 | 48 | -- This stores cached text for page view
|
49 | 49 | CREATE TABLE /*$wgDBprefix*/flaggedcache (
|
50 | | - fc_page_id int(10) NOT NULL,
|
| 50 | + fc_key char(255) binary NOT NULL default '',
|
51 | 51 | fc_cache mediumblob NOT NULL default '',
|
52 | 52 | fc_date char(14) NOT NULL,
|
53 | 53 |
|
54 | | - PRIMARY KEY fc_page_id (fc_page_id)
|
| 54 | + PRIMARY KEY fc_key (fc_key)
|
55 | 55 | ) TYPE=InnoDB; |
\ No newline at end of file |
Index: branches/jhb/phase3/extensions/FlaggedRevsPage.i18n.php |
— | — | @@ -35,8 +35,8 @@ |
36 | 36 | than the top revision. The content of this approved revision will remain constant regardless of any transcluded |
37 | 37 | pages or internal images. Users on this wiki will still be able to access |
38 | 38 | unreviewed content through the page history.", |
39 | | - 'revreview-images' => 'Internal images on this page will be copied to the stable image directory and stored |
40 | | - there until no reviewed revisions use them. The following images are transcluded onto this page:', |
| 39 | + 'revreview-images' => 'Internal images on this page will be copied to the stable image directory, updating |
| 40 | + existing versions, and stored there until no reviewed revisions use them. The following images are transcluded onto this page:', |
41 | 41 | |
42 | 42 | 'revreview-hist' => '[reviewed]', |
43 | 43 | |