public $mDataLoaded = false; // !< Boolean
public $mIsRedirect = false; // !< Boolean
public $mLatest = false; // !< Integer (false means "not loaded")
- public $mPreparedEdit = false; // !< Array
/**@}}*/
+ /** @var stdclass Map of cache fields (text, parser output, ect) for a proposed/new edit */
+ protected $mPreparedEdit = false;
+
/**
* @var int
*/
$this->mTimestamp = '';
$this->mIsRedirect = false;
$this->mLatest = false;
+ // Bug 57026: do not clear mPreparedEdit since prepareTextForEdit() already checks
+ // the requested rev ID and content against the cached one for equality. For most
+ // content types, the output should not change during the lifetime of this cache.
+ // Clearing it can cause extra parses on edit for no reason.
+ }
+
+ /**
+ * Clear the mPreparedEdit cache field, as may be needed by mutable content types
+ * @return void
+ * @since 1.23
+ */
+ public function clearPreparedEdit() {
$this->mPreparedEdit = false;
}
* @return Status
*/
public function doUpdateRestrictions( array $limit, array $expiry, &$cascade, $reason, User $user ) {
- global $wgCascadingRestrictionLevels;
+ global $wgCascadingRestrictionLevels, $wgContLang;
if ( wfReadOnly() ) {
return Status::newFatal( 'readonlytext', wfReadOnlyReason() );
$logAction = 'protect';
}
+ // Truncate for whole multibyte characters
+ $reason = $wgContLang->truncate( $reason, 255 );
+
if ( $id ) { // Protection of existing page
if ( !wfRunHooks( 'ArticleProtect', array( &$this, &$user, $limit, $reason ) ) ) {
return Status::newGood();
'pt_namespace' => $this->mTitle->getNamespace(),
'pt_title' => $this->mTitle->getDBkey(),
'pt_create_perm' => $limit['create'],
- 'pt_timestamp' => $dbw->encodeExpiry( wfTimestampNow() ),
+ 'pt_timestamp' => $dbw->timestamp(),
'pt_expiry' => $dbw->encodeExpiry( $expiry['create'] ),
'pt_user' => $user->getId(),
'pt_reason' => $reason,
// Update the protection log
$log = new LogPage( 'protect' );
- $log->addEntry( $logAction, $this->mTitle, trim( $reason ), $params, $user );
+ $log->addEntry( $logAction, $this->mTitle, $reason, $params, $user );
return Status::newGood();
}
$updates = $this->getDeletionUpdates( $content );
DataUpdate::runUpdates( $updates );
+ // Reparse any pages transcluding this page
+ LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );
+
// Clear caches
WikiPage::onArticleDelete( $this->mTitle );