30 [
'overwrite',
'overwriteSame',
'headers' ],
39 $status = StatusValue::newGood();
43 $maxFileSize = $this->backend->maxFileSizeInternal();
44 if ( $sourceSize > $maxFileSize ) {
45 $status->fatal(
'backend-fail-maxsize', $this->params[
'dst'], $maxFileSize );
55 if ( $status->isOK() ) {
56 $batchPredicates->
assumeFileExists( $this->params[
'dst'], $sourceSize, $sourceSha1 );
63 if ( $this->overwriteSameCase ) {
64 $status = StatusValue::newGood();
67 $status = $this->backend->createInternal( $this->
setFlags( $this->params ) );
74 return strlen( $this->params[
'content'] );
78 return Wikimedia\base_convert( sha1( $this->params[
'content'] ), 16, 36, 31 );
82 return [ $this->params[
'dst'] ];
Create a file in the backend with the given content.
allowedParams()
Get the file operation parameters.
doPrecheck(FileStatePredicates $opPredicates, FileStatePredicates $batchPredicates)
Do a dry-run precondition check of the operation in the context of op batch.
storagePathsChanged()
Get a list of storage paths written to for this operation.
FileBackend helper class for representing operations.
precheckDestExistence(FileStatePredicates $opPredicates, $sourceSize, $sourceSha1)
Check for errors with regards to the destination file already existing.
setFlags(array $params)
Adjust params to FileBackendStore internal file calls.
Helper class for tracking counterfactual file states when pre-checking file operation batches.
assumeFileExists(string $path, $size, $sha1Base36)
Predicate that a file exists at the path.