http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97767
Revision: 97767
Author: aaron
Date: 2011-09-21 21:32:24 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
Clear findFile() process cache of file moves (issue came up with bug bug 31056)
Modified Paths:
--------------
trunk/phase3/includes/Title.php
trunk/phase3/includes/filerepo/RepoGroup.php
Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php 2011-09-21 21:30:38 UTC (rev 97766)
+++ trunk/phase3/includes/Title.php 2011-09-21 21:32:24 UTC (rev 97767)
@@ -3168,8 +3168,8 @@
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 );
@@ -3180,6 +3180,9 @@
}
}
}
+ // 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 );
Modified: trunk/phase3/includes/filerepo/RepoGroup.php
===================================================================
--- trunk/phase3/includes/filerepo/RepoGroup.php 2011-09-21 21:30:38 UTC
(rev 97766)
+++ trunk/phase3/includes/filerepo/RepoGroup.php 2011-09-21 21:32:24 UTC
(rev 97767)
@@ -385,4 +385,19 @@
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] );
+ }
+ }
+ }
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs