/**@}}*/
/** @var stdclass Map of cache fields (text, parser output, ect) for a proposed/new edit */
- protected $mPreparedEdit = false;
+ public $mPreparedEdit = false;
/**
* @var int
// Reparse any pages transcluding this page
LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );
+ // Reparse any pages including this image
+ if ( $this->mTitle->getNamespace() == NS_FILE ) {
+ LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'imagelinks' );
+ }
+
// Clear caches
WikiPage::onArticleDelete( $this->mTitle );
return array( array( 'notvisiblerev' ) );
}
- $set = array();
- if ( $bot && $guser->isAllowed( 'markbotedits' ) ) {
- // Mark all reverted edits as bot
- $set['rc_bot'] = 1;
- }
-
- if ( $wgUseRCPatrol ) {
- // Mark all reverted edits as patrolled
- $set['rc_patrolled'] = 1;
- }
-
- if ( count( $set ) ) {
- $dbw->update( 'recentchanges', $set,
- array( /* WHERE */
- 'rc_cur_id' => $current->getPage(),
- 'rc_user_text' => $current->getUserText(),
- 'rc_timestamp > ' . $dbw->addQuotes( $s->rev_timestamp ),
- ), __METHOD__
- );
- }
-
// Generate the edit summary if necessary
$target = Revision::newFromId( $s->rev_id );
if ( empty( $summary ) ) {
return $status->getErrorsArray();
}
+ $set = array();
+ if ( $bot && $guser->isAllowed( 'markbotedits' ) ) {
+ // Mark all reverted edits as bot
+ $set['rc_bot'] = 1;
+ }
+
+ if ( $wgUseRCPatrol ) {
+ // Mark all reverted edits as patrolled
+ $set['rc_patrolled'] = 1;
+ }
+
+ if ( count( $set ) ) {
+ $dbw->update( 'recentchanges', $set,
+ array( /* WHERE */
+ 'rc_cur_id' => $current->getPage(),
+ 'rc_user_text' => $current->getUserText(),
+ 'rc_timestamp > ' . $dbw->addQuotes( $s->rev_timestamp ),
+ ), __METHOD__
+ );
+ }
+
if ( !empty( $status->value['revision'] ) ) {
$revId = $status->value['revision']->getId();
} else {
return;
}
- // templatelinks table may have become out of sync,
+ // templatelinks or imagelinks tables may have become out of sync,
// especially if using variable-based transclusions.
// For paranoia, check if things have changed and if
// so apply updates to the database. This will ensure
// that cascaded protections apply as soon as the changes
// are visible.
- // Get templates from templatelinks
+ // Get templates from templatelinks and images from imagelinks
$id = $this->getId();
- $tlTemplates = array();
+ $dbLinks = array();
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'templatelinks' ),
);
foreach ( $res as $row ) {
- $tlTemplates["{$row->tl_namespace}:{$row->tl_title}"] = true;
+ $dbLinks["{$row->tl_namespace}:{$row->tl_title}"] = true;
}
- // Get templates from parser output.
- $poTemplates = array();
+ $dbr = wfGetDB( DB_SLAVE );
+ $res = $dbr->select( array( 'imagelinks' ),
+ array( 'il_to' ),
+ array( 'il_from' => $id ),
+ __METHOD__
+ );
+
+ foreach ( $res as $row ) {
+ $dbLinks[NS_FILE . ":{$row->il_to}"] = true;
+ }
+
+ // Get templates and images from parser output.
+ $poLinks = array();
foreach ( $parserOutput->getTemplates() as $ns => $templates ) {
foreach ( $templates as $dbk => $id ) {
- $poTemplates["$ns:$dbk"] = true;
+ $poLinks["$ns:$dbk"] = true;
}
}
+ foreach ( $parserOutput->getImages() as $dbk => $id ) {
+ $poLinks[NS_FILE . ":$dbk"] = true;
+ }
// Get the diff
- $templates_diff = array_diff_key( $poTemplates, $tlTemplates );
+ $links_diff = array_diff_key( $poLinks, $dbLinks );
- if ( count( $templates_diff ) > 0 ) {
+ if ( count( $links_diff ) > 0 ) {
// Whee, link updates time.
// Note: we are only interested in links here. We don't need to get other DataUpdate items from the parser output.
$u = new LinksUpdate( $this->mTitle, $parserOutput, false );
return $this->mTitle->getTemplateLinksFrom();
}
- /**
- * Perform article updates on a special page creation.
- *
- * @param $rev Revision object
- *
- * @todo This is a shitty interface function. Kill it and replace the
- * other shitty functions like doEditUpdates and such so it's not needed
- * anymore.
- * @deprecated since 1.18, use doEditUpdates()
- */
- public function createUpdates( $rev ) {
- wfDeprecated( __METHOD__, '1.18' );
- global $wgUser;
- $this->doEditUpdates( $rev, $wgUser, array( 'created' => true ) );
- }
-
/**
* This function is called right before saving the wikitext,
* so we can do things like signatures and links-in-context.
$this->parserOutput = ParserCache::singleton()->getDirty( $this->page, $this->parserOptions );
if ( $this->parserOutput === false ) {
- wfDebugLog( 'dirty', "dirty missing\n" );
+ wfDebugLog( 'dirty', 'dirty missing' );
wfDebug( __METHOD__ . ": no dirty cache\n" );
return false;
} else {
wfDebug( __METHOD__ . ": sending dirty output\n" );
- wfDebugLog( 'dirty', "dirty output {$this->cacheKey}\n" );
+ wfDebugLog( 'dirty', "dirty output {$this->cacheKey}" );
$this->isDirty = true;
return true;
}