r33062 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33061‎ | r33062 | r33063 >
Date:06:15, 10 April 2008
Author:aaron
Status:old
Tags:
Comment:
Support $wgRevisionCacheExpiry
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevision.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -588,7 +588,7 @@
589589 * Removes flagged revision data for this page/id set
590590 */
591591 function unapproveRevision( $frev ) {
592 - global $wgUser, $wgParser;
 592+ global $wgUser, $wgParser, $wgRevisionCacheExpiry, $wgMemc;
593593
594594 $user = $wgUser->getId();
595595
@@ -605,6 +605,12 @@
606606 # Update the article review log
607607 $this->updateLog( $this->page, $this->dims, $this->comment, $this->oldid, false );
608608
 609+ # Kill any text cache
 610+ if( $wgRevisionCacheExpiry ) {
 611+ $key = wfMemcKey( 'flaggedrevisiontext', 'revid', $frev->getRevId() );
 612+ $wgMemc->delete( $key );
 613+ }
 614+
609615 $article = new Article( $this->page );
610616 # Update the links tables as a new stable version
611617 # may now be the default page.
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php
@@ -18,6 +18,7 @@
1919 * @access private
2020 */
2121 function __construct( $title, $row ) {
 22+ wfProfileIn( __METHOD__ );
2223 $this->mTitle = $title;
2324 $this->mRevId = intval( $row->fr_rev_id );
2425 $this->mPageId = intval( $row->fr_page_id );
@@ -41,11 +42,27 @@
4243 } else {
4344 $this->mText = $row->fr_text;
4445 }
 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+ }
4557 # Uncompress if needed
4658 $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+ }
4763 } else {
4864 $this->mText = null;
4965 }
 66+ wfProfileOut( __METHOD__ );
5067 }
5168
5269 /**

Status & tagging log