}
$this->fileExists = true;
- $this->maybeUpgradeRow();
}
/**
/**
* Upgrade a row if it needs it
*/
- function maybeUpgradeRow() {
+ protected function maybeUpgradeRow() {
global $wgUpdateCompatibleMetadata;
if ( wfReadOnly() || $this->upgrading ) {
/** 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;
}
*/
function purgeCache( $options = [] ) {
// Refresh metadata cache
+ $this->maybeUpgradeRow();
$this->purgeMetadataCache();
// Delete thumbnails
$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 )