MediaWiki  master
LocalFileDeleteBatch Class Reference

Helper class for file deletion. More...

Collaboration diagram for LocalFileDeleteBatch:

Public Member Functions

 __construct (File $file, UserIdentity $user, $reason='', $suppress=false)
 
 addCurrent ()
 
 addOld ( $oldName)
 
 addOlds ()
 Add the old versions of the image to the batch. More...
 
 execute ()
 Run the transaction. More...
 

Protected Member Functions

 doDBInserts ()
 
 getHashes (StatusValue $status)
 
 getOldRels ()
 
 removeNonexistentFiles ( $batch)
 Removes non-existent files from a deletion batch. More...
 

Private Member Functions

 doDBDeletes ()
 

Private Attributes

array $archiveUrls = []
 
array[] $deletionBatch
 Items to be processed in the deletion batch. More...
 
LocalFile $file
 
string $reason
 
array $srcRels = []
 
bool $suppress
 Whether to suppress all suppressable fields when deleting. More...
 
UserIdentity $user
 

Detailed Description

Helper class for file deletion.

Definition at line 33 of file LocalFileDeleteBatch.php.

Constructor & Destructor Documentation

◆ __construct()

LocalFileDeleteBatch::__construct ( File  $file,
UserIdentity  $user,
  $reason = '',
  $suppress = false 
)
Parameters
File$file
UserIdentity$user
string$reason
bool$suppress

Definition at line 61 of file LocalFileDeleteBatch.php.

References $file, $reason, $suppress, and $user.

Member Function Documentation

◆ addCurrent()

LocalFileDeleteBatch::addCurrent ( )

Definition at line 73 of file LocalFileDeleteBatch.php.

◆ addOld()

LocalFileDeleteBatch::addOld (   $oldName)
Parameters
string$oldName

Definition at line 80 of file LocalFileDeleteBatch.php.

Referenced by addOlds().

◆ addOlds()

LocalFileDeleteBatch::addOlds ( )

Add the old versions of the image to the batch.

Returns
string[] List of archive names from old versions

Definition at line 89 of file LocalFileDeleteBatch.php.

References addOld().

◆ doDBDeletes()

LocalFileDeleteBatch::doDBDeletes ( )
private

Definition at line 293 of file LocalFileDeleteBatch.php.

References getOldRels().

Referenced by execute().

◆ doDBInserts()

LocalFileDeleteBatch::doDBInserts ( )
protected

Definition at line 183 of file LocalFileDeleteBatch.php.

References $ext, $reason, $res, $user, getOldRels(), OldLocalFile\getQueryInfo(), and User\newFromAnyId().

Referenced by execute().

◆ execute()

LocalFileDeleteBatch::execute ( )

Run the transaction.

Returns
Status

Definition at line 314 of file LocalFileDeleteBatch.php.

References $ext, $hashes, doDBDeletes(), doDBInserts(), getHashes(), and removeNonexistentFiles().

◆ getHashes()

LocalFileDeleteBatch::getHashes ( StatusValue  $status)
protected
Parameters
StatusValue$statusTo add error messages to
Returns
array

Definition at line 127 of file LocalFileDeleteBatch.php.

References $hashes, $res, StatusValue\error(), and getOldRels().

Referenced by execute().

◆ getOldRels()

LocalFileDeleteBatch::getOldRels ( )
protected
Returns
array

Definition at line 110 of file LocalFileDeleteBatch.php.

References $srcRels.

Referenced by doDBDeletes(), doDBInserts(), and getHashes().

◆ removeNonexistentFiles()

LocalFileDeleteBatch::removeNonexistentFiles (   $batch)
protected

Removes non-existent files from a deletion batch.

Parameters
array[]$batch
Returns
Status A good status with existing files in $batch as value, or a fatal status in case of I/O errors.

Definition at line 387 of file LocalFileDeleteBatch.php.

References StatusValue\newFatal(), and StatusValue\newGood().

Referenced by execute().

Member Data Documentation

◆ $archiveUrls

array LocalFileDeleteBatch::$archiveUrls = []
private

Definition at line 44 of file LocalFileDeleteBatch.php.

◆ $deletionBatch

array [] LocalFileDeleteBatch::$deletionBatch
private

Items to be processed in the deletion batch.

Definition at line 47 of file LocalFileDeleteBatch.php.

◆ $file

LocalFile LocalFileDeleteBatch::$file
private

Definition at line 35 of file LocalFileDeleteBatch.php.

Referenced by __construct().

◆ $reason

string LocalFileDeleteBatch::$reason
private

Definition at line 38 of file LocalFileDeleteBatch.php.

Referenced by __construct(), and doDBInserts().

◆ $srcRels

array LocalFileDeleteBatch::$srcRels = []
private

Definition at line 41 of file LocalFileDeleteBatch.php.

Referenced by getOldRels().

◆ $suppress

bool LocalFileDeleteBatch::$suppress
private

Whether to suppress all suppressable fields when deleting.

Definition at line 50 of file LocalFileDeleteBatch.php.

Referenced by __construct().

◆ $user

UserIdentity LocalFileDeleteBatch::$user
private

Definition at line 53 of file LocalFileDeleteBatch.php.

Referenced by __construct(), and doDBInserts().


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