filerepo: only trigger maybeUpgradeRow() on action=purge
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 29 Mar 2019 08:22:22 +0000 (01:22 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 29 Mar 2019 08:35:51 +0000 (01:35 -0700)
Bug: T179760
Change-Id: I36ca7517702d0c2dfbcedd4d2c132cebdce7442c

includes/filerepo/file/LocalFile.php

index 9b9e748..134a104 100644 (file)
@@ -634,7 +634,6 @@ class LocalFile extends File {
                }
 
                $this->fileExists = true;
-               $this->maybeUpgradeRow();
        }
 
        /**
@@ -659,7 +658,7 @@ class LocalFile extends File {
        /**
         * Upgrade a row if it needs it
         */
-       function maybeUpgradeRow() {
+       protected function maybeUpgradeRow() {
                global $wgUpdateCompatibleMetadata;
 
                if ( wfReadOnly() || $this->upgrading ) {
@@ -1028,6 +1027,7 @@ class LocalFile extends File {
         */
        function purgeCache( $options = [] ) {
                // Refresh metadata cache
+               $this->maybeUpgradeRow();
                $this->purgeMetadataCache();
 
                // Delete thumbnails