return $err;
}
- // If it is a file, move it first. It is done before all other moving stuff is
- // done because it's hard to revert
+ // If it is a file, move it first.
+ // It is done before all other moving stuff is done because it's hard to revert.
$dbw = wfGetDB( DB_MASTER );
if ( $this->getNamespace() == NS_FILE ) {
$file = wfLocalFile( $this );
}
}
}
+ // Clear RepoGroup process cache
+ RepoGroup::singleton()->clearCache( $this );
+ RepoGroup::singleton()->clearCache( $nt ); # clear false negative cache
$dbw->begin(); # If $file was a LocalFile, its transaction would have closed our own.
$pageid = $this->getArticleID( self::GAID_FOR_UPDATE );
unset( $this->cache[$key] );
}
}
+
+ /**
+ * Clear RepoGroup process cache used for finding a file
+ * @param $title Title|null Title of the file or null to clear all files
+ */
+ public function clearCache( Title $title = null ) {
+ if ( $title == null ) {
+ $this->cache = array();
+ } else {
+ $dbKey = $title->getDBkey();
+ if ( isset( $this->cache[$dbKey] ) ) {
+ unset( $this->cache[$dbKey] );
+ }
+ }
+ }
}