MediaWiki REL1_33
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.
 
 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.
 

Private Attributes

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

Detailed Description

Helper class for file undeletion.

Definition at line 2713 of file LocalFile.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 2733 of file LocalFile.php.

References $file, and $unsuppress.

Member Function Documentation

◆ addAll()

LocalFileRestoreBatch::addAll ( )

Add all revisions of the file.

Definition at line 2759 of file LocalFile.php.

◆ addId()

LocalFileRestoreBatch::addId ( $fa_id)

Add a file by ID.

Parameters
int$fa_id

Definition at line 2744 of file LocalFile.php.

References and().

◆ addIds()

LocalFileRestoreBatch::addIds ( $ids)

Add a whole lot of files by ID.

Parameters
int[]$ids

Definition at line 2752 of file LocalFile.php.

References $ids, and and().

◆ 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 3078 of file LocalFile.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 3097 of file LocalFile.php.

References $cleanupBatch, $success, and and().

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 2771 of file LocalFile.php.

References $ids, $wgLang, and(), cleanupFailedBatch(), File\DELETED_FILE, LocalRepo\getHashFromKey(), ArchivedFile\getQueryInfo(), User\newFromAnyId(), FileRepo\OVERWRITE_SAME, removeNonexistentFiles(), RepoGroup\singleton(), wfDebug(), and wfTimestamp().

◆ removeNonexistentFiles()

LocalFileRestoreBatch::removeNonexistentFiles ( $triplets)
protected

Removes non-existent files from a store batch.

Parameters
array$triplets
Returns
Status

Definition at line 3027 of file LocalFile.php.

References $file, and and().

Referenced by execute().

◆ removeNonexistentFromCleanup()

LocalFileRestoreBatch::removeNonexistentFromCleanup ( $batch)
protected

Removes non-existent files from a cleanup batch.

Parameters
string[]$batch
Returns
string[]

Definition at line 3053 of file LocalFile.php.

References $batch, $file, and and().

Referenced by cleanup().

Member Data Documentation

◆ $all

bool LocalFileRestoreBatch::$all
private

Add all revisions of the file.

Definition at line 2724 of file LocalFile.php.

◆ $cleanupBatch

string [] LocalFileRestoreBatch::$cleanupBatch
private

List of file IDs to restore.

Definition at line 2718 of file LocalFile.php.

Referenced by cleanupFailedBatch().

◆ $file

LocalFile LocalFileRestoreBatch::$file
private

◆ $ids

string [] LocalFileRestoreBatch::$ids
private

List of file IDs to restore.

Definition at line 2721 of file LocalFile.php.

Referenced by addIds(), and execute().

◆ $unsuppress

bool LocalFileRestoreBatch::$unsuppress = false
private

Whether to remove all settings for suppressed fields.

Definition at line 2727 of file LocalFile.php.

Referenced by __construct().


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