MediaWiki REL1_39
StoreFileOp Class Reference

Store a file into the backend from a file on the file system. More...

Inheritance diagram for StoreFileOp:
Collaboration diagram for StoreFileOp:

Public Member Functions

 storagePathsChanged ()
 Get a list of storage paths written to for this operation.
 
- Public Member Functions inherited from 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 (array &$predicates)
 Check preconditions of the operation without writing anything.
 
 storagePathsRead ()
 Get a list of storage paths read from for this operation.
 
 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 (array &$predicates)
 
 getSourceSha1Base36 ()
 precheckDestExistence() helper function to get the source file SHA-1.
 
 getSourceSize ()
 precheckDestExistence() helper function to get the source file size.
 
- Protected Member Functions inherited from FileOp
 fileExists ( $source, array $predicates)
 Check if a file will exist in storage when this operation is attempted.
 
 fileSha1 ( $source, array $predicates)
 Get the SHA-1 of a file in storage when this operation is attempted.
 
 fileSize ( $source, array $predicates)
 Get the size a file in storage will have when this operation is attempted.
 
 precheckDestExistence (array $predicates)
 Check for errors with regards to the destination file already existing.
 
 setFlags (array $params)
 Adjust params to FileBackendStore internal file calls.
 

Additional Inherited Members

- Static Public Member Functions inherited from FileOp
static newDependencies ()
 Get a new empty dependency tracking array for paths read/written to.
 
static newPredicates ()
 Get a new empty predicates array for precheck()
 
- Static Protected Member Functions inherited from FileOp
static normalizeIfValidStoragePath ( $path)
 Normalize a string if it is a valid storage path.
 
- Protected Attributes inherited from FileOp
bool $async = false
 
FileBackendStore $backend
 
bool $cancelled = false
 
bool $destExists
 
bool $failed = false
 
LoggerInterface $logger
 
bool $overwriteSameCase
 
array $params = []
 
string bool $sourceSha1
 
int bool $sourceSize
 
int $state = self::STATE_NEW
 
const ASSUMED_EXISTS = 'exists'
 
const ASSUMED_SHA1 = 'sha1'
 
const ASSUMED_SIZE = 'size'
 

Detailed Description

Store a file into the backend from a file on the file system.

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

Definition at line 30 of file StoreFileOp.php.

Member Function Documentation

◆ allowedParams()

StoreFileOp::allowedParams ( )
protected

Get the file operation parameters.

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

Reimplemented from FileOp.

Definition at line 31 of file StoreFileOp.php.

◆ doAttempt()

StoreFileOp::doAttempt ( )
protected
Returns
StatusValue

Reimplemented from FileOp.

Definition at line 69 of file StoreFileOp.php.

References FileOp\setFlags().

◆ doPrecheck()

StoreFileOp::doPrecheck ( array & $predicates)
protected
Parameters
array&$predicates
Returns
StatusValue

Reimplemented from FileOp.

Definition at line 39 of file StoreFileOp.php.

References FileOp\$destExists, FileOp\$sourceSha1, FileOp\$sourceSize, FileOp\ASSUMED_EXISTS, FileOp\ASSUMED_SHA1, FileOp\ASSUMED_SIZE, and FileOp\precheckDestExistence().

◆ getSourceSha1Base36()

StoreFileOp::getSourceSha1Base36 ( )
protected

precheckDestExistence() helper function to get the source file SHA-1.

Subclasses should overwrite this if the source is not in storage.

Returns
string|false|null Returns false on failure

Reimplemented from FileOp.

Definition at line 88 of file StoreFileOp.php.

◆ getSourceSize()

StoreFileOp::getSourceSize ( )
protected

precheckDestExistence() helper function to get the source file size.

Subclasses should overwrite this if the source is not in storage.

Returns
int|false|null Returns false on failure

Reimplemented from FileOp.

Definition at line 80 of file StoreFileOp.php.

◆ storagePathsChanged()

StoreFileOp::storagePathsChanged ( )

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

Returns
array

Reimplemented from FileOp.

Definition at line 99 of file StoreFileOp.php.


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