MediaWiki master
LocalFileRestoreBatch Class Reference

Helper class for file undeletion. More...

Public Member Functions

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

Protected Member Functions

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

Detailed Description

Helper class for file undeletion.

Access: internal

Definition at line 35 of file LocalFileRestoreBatch.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 55 of file LocalFileRestoreBatch.php.

Member Function Documentation

◆ addAll()

LocalFileRestoreBatch::addAll ( )

Add all revisions of the file.

Definition at line 81 of file LocalFileRestoreBatch.php.

◆ addId()

LocalFileRestoreBatch::addId (   $fa_id)

Add a file by ID.

Parameters
int$fa_id

Definition at line 66 of file LocalFileRestoreBatch.php.

◆ addIds()

LocalFileRestoreBatch::addIds (   $ids)

Add a whole lot of files by ID.

Parameters
int[]$ids

Definition at line 74 of file LocalFileRestoreBatch.php.

◆ cleanup()

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 419 of file LocalFileRestoreBatch.php.

References removeNonexistentFromCleanup().

◆ cleanupFailedBatch()

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

Cleanup a failed batch.

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

Parameters
Status$storeStatus
array[]$storeBatch

Definition at line 438 of file LocalFileRestoreBatch.php.

References $success.

Referenced by execute().

◆ 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 93 of file LocalFileRestoreBatch.php.

References $wgLang, cleanupFailedBatch(), FileRepo\OVERWRITE_SAME, removeNonexistentFiles(), wfDebug(), and wfTimestamp().

◆ removeNonexistentFiles()

LocalFileRestoreBatch::removeNonexistentFiles (   $triplets)
protected

Removes non-existent files from a store batch.

Parameters
array[]$triplets
Returns
Status

Definition at line 368 of file LocalFileRestoreBatch.php.

Referenced by execute().

◆ removeNonexistentFromCleanup()

LocalFileRestoreBatch::removeNonexistentFromCleanup (   $batch)
protected

Removes non-existent files from a cleanup batch.

Parameters
string[]$batch
Returns
string[]

Definition at line 394 of file LocalFileRestoreBatch.php.

Referenced by cleanup().


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