r76242 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76241‎ | r76242 | r76243 >
Date:11:54, 7 November 2010
Author:hashar
Status:resolved (Comments)
Tags:
Comment:
Follow up r65500 : invalidate Title protection cache.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1602,6 +1602,10 @@
16031603 return $this->mTitleProtection;
16041604 }
16051605
 1606+ private function invalidateTitleProtectionCache() {
 1607+ unset( $this->mTitleProtection );
 1608+ }
 1609+
16061610 /**
16071611 * Update the title protection status
16081612 *
@@ -1650,6 +1654,8 @@
16511655 $dbw->delete( 'protected_titles', array( 'pt_namespace' => $namespace,
16521656 'pt_title' => $title ), __METHOD__ );
16531657 }
 1658+ $this->invalidateTitleProtectionCache();
 1659+
16541660 # Update the protection log
16551661 if ( $dbw->affectedRows() ) {
16561662 $log = new LogPage( 'protect' );
@@ -1676,6 +1682,7 @@
16771683 array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ),
16781684 __METHOD__
16791685 );
 1686+ $this->invalidateTitleProtectionCache();
16801687 }
16811688
16821689 /**
@@ -2058,6 +2065,7 @@
20592066 }
20602067 if ( $purgeExpired ) {
20612068 Title::purgeExpiredRestrictions();
 2069+ $this->invalidateTitleProtectionCache();
20622070 }
20632071
20642072 wfProfileOut( __METHOD__ );
@@ -2177,6 +2185,7 @@
21782186
21792187 if ( $purgeExpired ) {
21802188 Title::purgeExpiredRestrictions();
 2189+ $this->invalidateTitleProtectionCache();
21812190 }
21822191 }
21832192
@@ -2211,6 +2220,7 @@
22122221 $this->mRestrictions['create'] = explode( ',', trim( $title_protection['pt_create_perm'] ) );
22132222 } else { // Get rid of the old restrictions
22142223 Title::purgeExpiredRestrictions();
 2224+ $this->invalidateTitleProtectionCache();
22152225 }
22162226 } else {
22172227 $this->mRestrictionsExpiry['create'] = Block::decodeExpiry( '' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r79759Address my r76242 fixme....platonides21:26, 6 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65500cache the result of getTitleProtection to make testing easiermah00:23, 24 April 2010

Comments

#Comment by Platonides (talk | contribs)   16:29, 7 November 2010

You should be setting mTitleProtection to the known value. It's probably not worth keeping the function for the calls left.

#Comment by Reedy (talk | contribs)   02:17, 6 January 2011

Any suggestions on the known value?

Seems a relatively easy FIXME...

#Comment by Platonides (talk | contribs)   21:26, 6 January 2011

Changed in r79759.

Status & tagging log