var $mCascadeSources; ///< Where are the cascading restrictions coming from on this page?
var $mRestrictionsLoaded = false; ///< Boolean for initialisation on demand
var $mPrefixedText; ///< Text form including namespace/interwiki, initialised on demand
- var $mTitleProtection; ///< Cached value of getTitleProtection
+ var $mTitleProtection; ///< Cached value for getTitleProtection (create protection)
# Don't change the following default, NS_MAIN is hardcoded in several
# places. See bug 696.
var $mDefaultNamespace = NS_MAIN; // /< Namespace index when there is no namespace
/**
* Is this title subject to title protection?
+ * Title protection is the one applied against creation of such title.
*
* @return Mixed An associative array representing any existent title
* protection, or false if there's none.
return $this->mTitleProtection;
}
- private function invalidateTitleProtectionCache() {
- unset( $this->mTitleProtection );
- }
-
/**
* Update the title protection status
*
# Update protection table
if ( $create_perm != '' ) {
- $dbw->replace( 'protected_titles', array( array( 'pt_namespace', 'pt_title' ) ),
- array(
+ $this->mTitleProtection = array(
'pt_namespace' => $namespace,
'pt_title' => $title,
'pt_create_perm' => $create_perm,
'pt_expiry' => $encodedExpiry,
'pt_user' => $wgUser->getId(),
'pt_reason' => $reason,
- ), __METHOD__
- );
+ );
+ $dbw->replace( 'protected_titles', array( array( 'pt_namespace', 'pt_title' ) ),
+ $this->mTitleProtection, __METHOD__ );
} else {
$dbw->delete( 'protected_titles', array( 'pt_namespace' => $namespace,
'pt_title' => $title ), __METHOD__ );
+ $this->mTitleProtection = false;
}
- $this->invalidateTitleProtectionCache();
# Update the protection log
if ( $dbw->affectedRows() ) {
array( 'pt_namespace' => $this->getNamespace(), 'pt_title' => $this->getDBkey() ),
__METHOD__
);
- $this->invalidateTitleProtectionCache();
+ $this->mTitleProtection = false;
}
/**
}
if ( $purgeExpired ) {
Title::purgeExpiredRestrictions();
- $this->invalidateTitleProtectionCache();
}
wfProfileOut( __METHOD__ );
/**
* Compiles list of active page restrictions from both page table (pre 1.10)
- * and page_restrictions table
+ * and page_restrictions table for this existing page
*
* @param $rows array of db result objects
* @param $oldFashionedRestrictions string comma-separated list of page
* restrictions from page table (pre 1.10)
*/
- public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) {
+ private function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) {
$dbr = wfGetDB( DB_SLAVE );
$restrictionTypes = $this->getRestrictionTypes();
if ( $purgeExpired ) {
Title::purgeExpiredRestrictions();
- $this->invalidateTitleProtectionCache();
}
}
$this->mRestrictions['create'] = explode( ',', trim( $title_protection['pt_create_perm'] ) );
} else { // Get rid of the old restrictions
Title::purgeExpiredRestrictions();
- $this->invalidateTitleProtectionCache();
+ $this->mTitleProtection = false;
}
} else {
$this->mRestrictionsExpiry['create'] = Block::decodeExpiry( '' );