if ( $handler ) {
$validity = $handler->isMetadataValid( $this, $this->metadata );
if ( $validity === MediaHandler::METADATA_BAD
- || ( $validity === MediaHandler::METADATA_COMPATIBLE && $wgUpdateCompatibleMetadata )
+ || ( $validity === MediaHandler::METADATA_COMPATIBLE && $wgUpdateCompatibleMetadata )
) {
$this->upgradeRow();
$this->upgraded = true;
if ( in_array( $ext, $wgExcludeFromThumbnailPurge ) ) {
continue;
}
-
+
# Check that the base file name is part of the thumb name
# This is a basic sanity check to avoid erasing unrelated directories
if ( strpos( $file, $this->getName() ) !== false ) {
}
/**
- * Move or copy a file to a specified location. Returns a FileRepoStatus
+ * Move or copy a file to a specified location. Returns a FileRepoStatus
* object with the archive name in the "value" member on success.
*
* The archive name should be passed through to recordUpload for database
*/
function publishTo( $srcPath, $dstRel, $flags = 0 ) {
$this->lock();
-
+
$archiveName = wfTimestamp( TS_MW ) . '!'. $this->getName();
$archiveRel = 'archive/' . $this->getHashPath() . $archiveName;
$flags = $flags & File::DELETE_SOURCE ? LocalRepo::DELETE_SOURCE : 0;
return $status;
}
-
+
/**
- * Cleanup a failed batch. The batch was only partially successful, so
+ * Cleanup a failed batch. The batch was only partially successful, so
* rollback by removing all items that were succesfully copied.
- *
+ *
* @param Status $storeStatus
* @param array $storeBatch
*/
function cleanupFailedBatch( $storeStatus, $storeBatch ) {
- $cleanupBatch = array();
-
+ $cleanupBatch = array();
+
foreach ( $storeStatus->success as $i => $success ) {
// Check if this item of the batch was successfully copied
if ( $success ) {
$triplets = $this->getMoveTriplets();
$triplets = $this->removeNonexistentFiles( $triplets );
-
+
// Copy the files into their new location
$statusMove = $repo->storeBatch( $triplets );
wfDebugLog( 'imagemove', "Moved files for {$this->file->name}: {$statusMove->successCount} successes, {$statusMove->failCount} failures" );
return $statusDb;
}
$this->db->commit();
-
+
// Everything went ok, remove the source files
$this->cleanupSource( $triplets );
-
+
$status->merge( $statusDb );
$status->merge( $statusMove );
return $filteredTriplets;
}
-
+
/**
- * Cleanup a partially moved array of triplets by deleting the target
+ * Cleanup a partially moved array of triplets by deleting the target
* files. Called if something went wrong half way.
*/
function cleanupTarget( $triplets ) {
foreach ( $triplets as $triplet ) {
$pairs[] = array( $triplet[1], $triplet[2] );
}
-
+
$this->file->repo->cleanupBatch( $pairs );
}
-
+
/**
* Cleanup a fully moved array of triplets by deleting the source files.
- * Called at the end of the move process if everything else went ok.
+ * Called at the end of the move process if everything else went ok.
*/
function cleanupSource( $triplets ) {
// Create source file names from the triplets
foreach ( $triplets as $triplet ) {
$files[] = $triplet[0];
}
-
+
$this->file->repo->cleanupBatch( $files );
}
}