* Fix assorted version-related problems with the image row by reloading it from the file
*/
function upgradeRow() {
- $this->lock(); // begin
+ $this->lock();
$this->loadFromFile();
$this->invalidateCache();
- $this->unlock(); // done
+ $this->unlock();
$this->upgraded = true; // avoid rework/retries
}
// Trim spaces on user supplied text
$comment = trim( $comment );
- $this->lock(); // begin
+ $this->lock();
$status = $this->publish( $src, $flags, $options );
if ( $status->successCount >= 2 ) {
}
}
- $this->unlock(); // done
-
+ $this->unlock();
return $status;
}
return $this->readOnlyFatalStatus();
}
- $this->lock(); // begin
+ $this->lock();
$archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName();
$archiveRel = $this->getArchiveRel( $archiveName );
}
}
- $this->unlock(); // done
-
+ $this->unlock();
return $status;
}
wfDebugLog( 'imagemove', "Got request to move {$this->name} to " . $target->getText() );
$batch = new LocalFileMoveBatch( $this, $target );
- $this->lock(); // begin
+ $this->lock();
$batch->addCurrent();
$archiveNames = $batch->addOlds();
$status = $batch->execute();
- $this->unlock(); // done
+ $this->unlock();
wfDebugLog( 'imagemove', "Finished moving {$this->name}" );
$batch = new LocalFileDeleteBatch( $this, $reason, $suppress, $user );
- $this->lock(); // begin
+ $this->lock();
$batch->addCurrent();
// Get old version relative paths
$archiveNames = $batch->addOlds();
$status = $batch->execute();
- $this->unlock(); // done
+ $this->unlock();
if ( $status->isOK() ) {
DeferredUpdates::addUpdate( SiteStatsUpdate::factory( [ 'images' => -1 ] ) );
$batch = new LocalFileDeleteBatch( $this, $reason, $suppress, $user );
- $this->lock(); // begin
+ $this->lock();
$batch->addOld( $archiveName );
$status = $batch->execute();
- $this->unlock(); // done
+ $this->unlock();
$this->purgeOldThumbnails( $archiveName );
if ( $status->isOK() ) {
$batch = new LocalFileRestoreBatch( $this, $unsuppress );
- $this->lock(); // begin
+ $this->lock();
if ( !$versions ) {
$batch->addAll();
} else {
$cleanupStatus->failCount = 0;
$status->merge( $cleanupStatus );
}
- $this->unlock(); // done
+ $this->unlock();
return $status;
}
$this->load();
// Initialise now if necessary
if ( $this->sha1 == '' && $this->fileExists ) {
- $this->lock(); // begin
+ $this->lock();
$this->sha1 = $this->repo->getFileSha1( $this->getPath() );
if ( !wfReadOnly() && strval( $this->sha1 ) != '' ) {
$this->invalidateCache();
}
- $this->unlock(); // done
+ $this->unlock();
}
return $this->sha1;
$status = $repo->newGood();
$destFile = wfLocalFile( $this->target );
- $this->file->lock(); // begin
+ $this->file->lock();
$destFile->lock(); // quickly fail if destination is not available
$triplets = $this->getMoveTriplets();
"{$statusDb->successCount} successes, {$statusDb->failCount} failures" );
$destFile->unlock();
- $this->file->unlock(); // done
+ $this->file->unlock();
// Everything went ok, remove the source files
$this->cleanupSource( $triplets );