MediaWiki master
Wikimedia\FileBackend\FileOps\CopyFileOp Class Reference

Copy a file from one storage path to another in the backend. More...

Inherits Wikimedia\FileBackend\FileOps\FileOp.

Collaboration diagram for Wikimedia\FileBackend\FileOps\CopyFileOp:

Public Member Functions

 storagePathsChanged ()
 Get a list of storage paths written to for this operation.
 
 storagePathsRead ()
 Get a list of storage paths read from for this operation.
 
- Public Member Functions inherited from Wikimedia\FileBackend\FileOps\FileOp
 __construct (FileBackendStore $backend, array $params, LoggerInterface $logger)
 Build a new batch file operation transaction.
 
 applyDependencies (array $deps)
 Update a dependency tracking array to account for this operation.
 
 attempt ()
 Attempt the operation.
 
 attemptAsync ()
 Attempt the operation in the background.
 
 attemptAsyncQuick ()
 Attempt the operation in the background without regards to prechecks.
 
 attemptQuick ()
 Attempt the operation without regards to prechecks.
 
 dependsOn (array $deps)
 Check if this operation changes files listed in $paths.
 
 failed ()
 Check if this operation failed precheck() or attempt()
 
 getBackend ()
 Get the backend this operation is for.
 
 getParam ( $name)
 Get the value of the parameter with the given name.
 
 logFailure ( $action)
 Log a file operation failure and preserve any temp files.
 
 precheck (FileStatePredicates $predicates)
 Do a dry-run precondition check of the operation in the context of op batch.
 
 storagePathsReadOrChanged ()
 Get a list of storage paths read from or written to for this operation.
 

Protected Member Functions

 allowedParams ()
 Get the file operation parameters.
 
 doAttempt ()
 
 doPrecheck (FileStatePredicates $opPredicates, FileStatePredicates $batchPredicates)
 Do a dry-run precondition check of the operation in the context of op batch.
 
- Protected Member Functions inherited from Wikimedia\FileBackend\FileOps\FileOp
 precheckDestExistence (FileStatePredicates $opPredicates, $sourceSize, $sourceSha1)
 Check for errors with regards to the destination file already existing.
 
 resolveFileExistence ( $source, FileStatePredicates $opPredicates)
 Check if a file will exist in storage when this operation is attempted.
 
 resolveFileSha1Base36 ( $source, FileStatePredicates $opPredicates)
 Get the SHA-1 of a file in storage when this operation is attempted.
 
 resolveFileSize ( $source, FileStatePredicates $opPredicates)
 Get the size a file in storage will have when this operation is attempted.
 
 setFlags (array $params)
 Adjust params to FileBackendStore internal file calls.
 

Additional Inherited Members

- Static Public Member Functions inherited from Wikimedia\FileBackend\FileOps\FileOp
static newDependencies ()
 Get a new empty dependency tracking array for paths read/written to.
 
- Static Protected Member Functions inherited from Wikimedia\FileBackend\FileOps\FileOp
static normalizeIfValidStoragePath ( $path)
 Normalize a string if it is a valid storage path.
 
- Protected Attributes inherited from Wikimedia\FileBackend\FileOps\FileOp
bool $async = false
 Whether the operation is part of a concurrent sub-batch of operation.
 
FileBackendStore $backend
 
bool null $destExists
 
bool $failed = false
 Whether the operation pre-check or attempt stage failed.
 
LoggerInterface $logger
 
bool $noOp = false
 Whether the operation pre-check stage marked the attempt stage as a no-op.
 
bool null $overwriteSameCase
 
array $params = []
 
int $state = self::STATE_NEW
 Stage in the operation life-cycle.
 

Detailed Description

Copy a file from one storage path to another in the backend.

Parameters for this operation are outlined in FileBackend::doOperations().

Definition at line 33 of file CopyFileOp.php.

Member Function Documentation

◆ allowedParams()

Wikimedia\FileBackend\FileOps\CopyFileOp::allowedParams ( )
protected

Get the file operation parameters.

Returns
array (required params list, optional params list, list of params that are paths)

Reimplemented from Wikimedia\FileBackend\FileOps\FileOp.

Definition at line 34 of file CopyFileOp.php.

◆ doAttempt()

Wikimedia\FileBackend\FileOps\CopyFileOp::doAttempt ( )
protected

◆ doPrecheck()

Wikimedia\FileBackend\FileOps\CopyFileOp::doPrecheck ( FileStatePredicates $opPredicates,
FileStatePredicates $batchPredicates )
protected

Do a dry-run precondition check of the operation in the context of op batch.

Updates the batch predicates for all paths this op can change if an OK status is returned

Parameters
FileStatePredicates$opPredicatesCounterfactual file states for op paths at op start
FileStatePredicates$batchPredicatesCounterfactual file states for the op batch
Returns
StatusValue

Reimplemented from Wikimedia\FileBackend\FileOps\FileOp.

Definition at line 42 of file CopyFileOp.php.

References Wikimedia\FileBackend\FileOps\FileOp\$destExists, Wikimedia\FileBackend\FileOps\FileStatePredicates\assumeFileDoesNotExist(), Wikimedia\FileBackend\FileOps\FileStatePredicates\assumeFileExists(), Wikimedia\FileBackend\FileOps\FileOp\getParam(), Wikimedia\FileBackend\FileOps\FileOp\precheckDestExistence(), Wikimedia\FileBackend\FileOps\FileOp\resolveFileExistence(), Wikimedia\FileBackend\FileOps\FileOp\resolveFileSha1Base36(), and Wikimedia\FileBackend\FileOps\FileOp\resolveFileSize().

◆ storagePathsChanged()

Wikimedia\FileBackend\FileOps\CopyFileOp::storagePathsChanged ( )

Get a list of storage paths written to for this operation.

Returns
array

Reimplemented from Wikimedia\FileBackend\FileOps\FileOp.

Definition at line 110 of file CopyFileOp.php.

◆ storagePathsRead()

Wikimedia\FileBackend\FileOps\CopyFileOp::storagePathsRead ( )

Get a list of storage paths read from for this operation.

Returns
array

Reimplemented from Wikimedia\FileBackend\FileOps\FileOp.

Definition at line 106 of file CopyFileOp.php.


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