MediaWiki  1.28.0
LocalFileRestoreBatch Class Reference

Helper class for file undeletion. More...

Collaboration diagram for LocalFileRestoreBatch:

Public Member Functions

 __construct (File $file, $unsuppress=false)
 
 addAll ()
 Add all revisions of the file. More...
 
 addId ($fa_id)
 Add a file by ID. More...
 
 addIds ($ids)
 Add a whole lot of files by ID. More...
 
 cleanup ()
 Delete unused files in the deleted zone. More...
 
 execute ()
 Run the transaction, except the cleanup batch. More...
 

Protected Member Functions

 cleanupFailedBatch ($storeStatus, $storeBatch)
 Cleanup a failed batch. More...
 
 removeNonexistentFiles ($triplets)
 Removes non-existent files from a store batch. More...
 
 removeNonexistentFromCleanup ($batch)
 Removes non-existent files from a cleanup batch. More...
 

Private Attributes

bool $all
 Add all revisions of the file. More...
 
array $cleanupBatch
 List of file IDs to restore. More...
 
LocalFile $file
 
array $ids
 List of file IDs to restore. More...
 
bool $unsuppress = false
 Whether to remove all settings for suppressed fields. More...
 

Detailed Description

Helper class for file undeletion.

Definition at line 2441 of file LocalFile.php.

Constructor & Destructor Documentation

LocalFileRestoreBatch::__construct ( File  $file,
  $unsuppress = false 
)
Parameters
File$file
bool$unsuppress

Definition at line 2461 of file LocalFile.php.

References $file, $unsuppress, and file.

Member Function Documentation

LocalFileRestoreBatch::addAll ( )

Add all revisions of the file.

Definition at line 2487 of file LocalFile.php.

LocalFileRestoreBatch::addId (   $fa_id)

Add a file by ID.

Parameters
int$fa_id

Definition at line 2472 of file LocalFile.php.

LocalFileRestoreBatch::addIds (   $ids)

Add a whole lot of files by ID.

Parameters
int[]$ids

Definition at line 2480 of file LocalFile.php.

LocalFileRestoreBatch::cleanup ( )

Delete unused files in the deleted zone.

This should be called from outside the transaction in which execute() was called.

Returns
Status

Definition at line 2800 of file LocalFile.php.

References $status, file, and removeNonexistentFromCleanup().

LocalFileRestoreBatch::cleanupFailedBatch (   $storeStatus,
  $storeBatch 
)
protected

Cleanup a failed batch.

The batch was only partially successful, so rollback by removing all items that were succesfully copied.

Parameters
Status$storeStatus
array$storeBatch

Definition at line 2819 of file LocalFile.php.

References $success, as, and file.

Referenced by execute().

LocalFileRestoreBatch::execute ( )

Run the transaction, except the cleanup batch.

The cleanup batch should be run in a separate transaction, because it locks different rows and there's no need to keep the image row locked while it's acquiring those locks The caller may have its own transaction open. So we save the batch and let the caller call cleanup()

Returns
Status

Definition at line 2499 of file LocalFile.php.

References $ids, $status, $timestamp, $wgLang, DeferredUpdates\addUpdate(), as, cleanupFailedBatch(), File\DELETED_FILE, SiteStatsUpdate\factory(), file, LocalRepo\getHashFromKey(), global, FileRepo\OVERWRITE_SAME, removeNonexistentFiles(), ArchivedFile\selectFields(), RepoGroup\singleton(), TS_MW, TS_UNIX, wfDebug(), and wfTimestamp().

LocalFileRestoreBatch::removeNonexistentFiles (   $triplets)
protected

Removes non-existent files from a store batch.

Parameters
array$triplets
Returns
Status

Definition at line 2749 of file LocalFile.php.

References $file, $files, as, file, StatusValue\newFatal(), and StatusValue\newGood().

Referenced by execute().

LocalFileRestoreBatch::removeNonexistentFromCleanup (   $batch)
protected

Removes non-existent files from a cleanup batch.

Parameters
array$batch
Returns
array

Definition at line 2775 of file LocalFile.php.

References $batch, $file, $files, as, and file.

Referenced by cleanup().

Member Data Documentation

bool LocalFileRestoreBatch::$all
private

Add all revisions of the file.

Definition at line 2452 of file LocalFile.php.

array LocalFileRestoreBatch::$cleanupBatch
private

List of file IDs to restore.

Definition at line 2446 of file LocalFile.php.

LocalFile LocalFileRestoreBatch::$file
private
array LocalFileRestoreBatch::$ids
private

List of file IDs to restore.

Definition at line 2449 of file LocalFile.php.

Referenced by execute().

bool LocalFileRestoreBatch::$unsuppress = false
private

Whether to remove all settings for suppressed fields.

Definition at line 2455 of file LocalFile.php.

Referenced by __construct().


The documentation for this class was generated from the following file: