X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FLocalFile.php;h=aa04faec8f0d6d06bfe8107ec4fa06de63e6651d;hb=bf29eadf3ea4bcaff236c15b3ee7315cdf186da2;hp=a3d1624205c9ddc5fbd00f951d70b9325b354c21;hpb=84c46d38b7385c97fc3c1e865e3d7ba29f07520f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index a3d1624205..aa04faec8f 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -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 ) { @@ -797,11 +796,14 @@ class LocalFile extends File { /** isVisible inherited */ /** + * Checks if this file exists in its parent repo, as referenced by its + * virtual URL. + * * @return bool */ function isMissing() { if ( $this->missing === null ) { - list( $fileExists ) = $this->repo->fileExists( $this->getVirtualUrl() ); + $fileExists = $this->repo->fileExists( $this->getVirtualUrl() ); $this->missing = !$fileExists; } @@ -1028,6 +1030,7 @@ class LocalFile extends File { */ function purgeCache( $options = [] ) { // Refresh metadata cache + $this->maybeUpgradeRow(); $this->purgeMetadataCache(); // Delete thumbnails @@ -1838,8 +1841,13 @@ class LocalFile extends File { $this->lock(); - $archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName(); - $archiveRel = $this->getArchiveRel( $archiveName ); + if ( $this->isOld() ) { + $archiveRel = $dstRel; + $archiveName = basename( $archiveRel ); + } else { + $archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName(); + $archiveRel = $this->getArchiveRel( $archiveName ); + } if ( $repo->hasSha1Storage() ) { $sha1 = FileRepo::isVirtualUrl( $srcPath )