Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -588,7 +588,7 @@ |
589 | 589 | * Removes flagged revision data for this page/id set |
590 | 590 | */ |
591 | 591 | function unapproveRevision( $frev ) { |
592 | | - global $wgUser, $wgParser; |
| 592 | + global $wgUser, $wgParser, $wgRevisionCacheExpiry, $wgMemc; |
593 | 593 | |
594 | 594 | $user = $wgUser->getId(); |
595 | 595 | |
— | — | @@ -605,6 +605,12 @@ |
606 | 606 | # Update the article review log |
607 | 607 | $this->updateLog( $this->page, $this->dims, $this->comment, $this->oldid, false ); |
608 | 608 | |
| 609 | + # Kill any text cache |
| 610 | + if( $wgRevisionCacheExpiry ) { |
| 611 | + $key = wfMemcKey( 'flaggedrevisiontext', 'revid', $frev->getRevId() ); |
| 612 | + $wgMemc->delete( $key ); |
| 613 | + } |
| 614 | + |
609 | 615 | $article = new Article( $this->page ); |
610 | 616 | # Update the links tables as a new stable version |
611 | 617 | # may now be the default page. |
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | * @access private |
20 | 20 | */ |
21 | 21 | function __construct( $title, $row ) { |
| 22 | + wfProfileIn( __METHOD__ ); |
22 | 23 | $this->mTitle = $title; |
23 | 24 | $this->mRevId = intval( $row->fr_rev_id ); |
24 | 25 | $this->mPageId = intval( $row->fr_page_id ); |
— | — | @@ -41,11 +42,27 @@ |
42 | 43 | } else { |
43 | 44 | $this->mText = $row->fr_text; |
44 | 45 | } |
| 46 | + // Check cache first... |
| 47 | + global $wgRevisionCacheExpiry, $wgMemc; |
| 48 | + if( $wgRevisionCacheExpiry ) { |
| 49 | + $key = wfMemcKey( 'flaggedrevisiontext', 'revid', $this->getRevId() ); |
| 50 | + $text = $wgMemc->get( $key ); |
| 51 | + if( is_string($text) ) { |
| 52 | + $this->mText = $text; |
| 53 | + wfProfileOut( __METHOD__ ); |
| 54 | + return; |
| 55 | + } |
| 56 | + } |
45 | 57 | # Uncompress if needed |
46 | 58 | $this->mText = FlaggedRevs::uncompressText( $this->mText, $this->mFlags ); |
| 59 | + # Caching may be beneficial for massive use of external storage |
| 60 | + if( $wgRevisionCacheExpiry ) { |
| 61 | + $wgMemc->set( $key, $this->mText, $wgRevisionCacheExpiry ); |
| 62 | + } |
47 | 63 | } else { |
48 | 64 | $this->mText = null; |
49 | 65 | } |
| 66 | + wfProfileOut( __METHOD__ ); |
50 | 67 | } |
51 | 68 | |
52 | 69 | /** |