Avoid calling load() in LocalFile::invalidateCache; not needed
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 21 May 2015 18:23:19 +0000 (11:23 -0700)
committerOri.livneh <ori@wikimedia.org>
Thu, 21 May 2015 18:49:02 +0000 (18:49 +0000)
Change-Id: I1e2d61722a18e4046bdf7c375ea9c1dbbea4a157

includes/filerepo/file/File.php
includes/filerepo/file/LocalFile.php

index 6edd6fc..eb50a12 100644 (file)
@@ -163,7 +163,8 @@ abstract class File implements IDBAccessObject {
         * @param FileRepo|bool $repo
         */
        function __construct( $title, $repo ) {
-               if ( $title !== false ) { // subclasses may not use MW titles
+               // Some subclasses do not use $title, but set name/title some other way
+               if ( $title !== false ) {
                        $title = self::normalizeTitle( $title, 'exception' );
                }
                $this->title = $title;
index fe42c2d..b763c8d 100644 (file)
@@ -316,15 +316,12 @@ class LocalFile extends File {
         * Purge the file object/metadata cache
         */
        function invalidateCache() {
-               $this->load();
-
                $key = $this->getCacheKey();
                if ( !$key ) {
                        return;
                }
 
-               $cache = ObjectCache::getMainWANInstance();
-               $cache->delete( $key );
+               ObjectCache::getMainWANInstance()->delete( $key );
        }
 
        /**