return;
}
- $this->repo->getMasterDB()->onTransactionPreCommitOrIdle( function() use ( $key ) {
- ObjectCache::getMainWANInstance()->delete( $key );
- } );
+ $this->repo->getMasterDB()->onTransactionPreCommitOrIdle(
+ function () use ( $key ) {
+ ObjectCache::getMainWANInstance()->delete( $key );
+ },
+ __METHOD__
+ );
}
/**
private function loadFieldsWithTimestamp( $dbr, $fname ) {
$fieldMap = false;
- $row = $dbr->selectRow( 'image', $this->getLazyCacheFields( 'img_' ),
- [ 'img_name' => $this->getName(), 'img_timestamp' => $this->getTimestamp() ],
- $fname );
+ $row = $dbr->selectRow( 'image', $this->getLazyCacheFields( 'img_' ), [
+ 'img_name' => $this->getName(),
+ 'img_timestamp' => $dbr->timestamp( $this->getTimestamp() )
+ ], $fname );
if ( $row ) {
$fieldMap = $this->unprefixRow( $row, 'img_' );
} else {
# File may have been uploaded over in the meantime; check the old versions
- $row = $dbr->selectRow( 'oldimage', $this->getLazyCacheFields( 'oi_' ),
- [ 'oi_name' => $this->getName(), 'oi_timestamp' => $this->getTimestamp() ],
- $fname );
+ $row = $dbr->selectRow( 'oldimage', $this->getLazyCacheFields( 'oi_' ), [
+ 'oi_name' => $this->getName(),
+ 'oi_timestamp' => $dbr->timestamp( $this->getTimestamp() )
+ ], $fname );
if ( $row ) {
$fieldMap = $this->unprefixRow( $row, 'oi_' );
}
) {
$props = $this->repo->getFileProps( $srcPath );
} else {
- $props = FSFile::getPropsFromPath( $srcPath );
+ $mwProps = new MWFileProps( MimeMagic::singleton() );
+ $props = $mwProps->getPropsFromPath( $srcPath, true );
}
}
);
if ( isset( $status->value['revision'] ) ) {
+ /** @var $rev Revision */
+ $rev = $status->value['revision'];
// Associate new page revision id
- $logEntry->setAssociatedRevId( $status->value['revision']->getId() );
+ $logEntry->setAssociatedRevId( $rev->getId() );
}
// This relies on the resetArticleID() call in WikiPage::insertOn(),
// which is triggered on $descTitle by doEditContent() above.
}
// Release the lock *after* commit to avoid row-level contention.
// Make sure it triggers on rollback() as well as commit() (T132921).
- $dbw->onTransactionResolution( function () use ( $logger ) {
- $status = $this->releaseFileLock();
- if ( !$status->isGood() ) {
- $logger->error( "Failed to unlock '{file}'", [ 'file' => $this->name ] );
- }
- } );
+ $dbw->onTransactionResolution(
+ function () use ( $logger ) {
+ $status = $this->releaseFileLock();
+ if ( !$status->isGood() ) {
+ $logger->error( "Failed to unlock '{file}'", [ 'file' => $this->name ] );
+ }
+ },
+ __METHOD__
+ );
// Callers might care if the SELECT snapshot is safely fresh
$this->lockedOwnTrx = $makesTransaction;
}
// Even if some files could be copied, fail entirely as that is the
// easiest thing to do without data loss
$this->cleanupFailedBatch( $storeStatus, $storeBatch );
- $status->ok = false;
+ $status->setOK( false );
$this->file->unlock();
return $status;
if ( !$statusDb->isGood() ) {
$destFile->unlock();
$this->file->unlock();
- $statusDb->ok = false;
+ $statusDb->setOK( false );
return $statusDb;
}
$this->file->unlock();
wfDebugLog( 'imagemove', "Error in moving files: "
. $statusMove->getWikiText( false, false, 'en' ) );
- $statusMove->ok = false;
+ $statusMove->setOK( false );
return $statusMove;
}