32 [
'overwrite',
'overwriteSame',
'ignoreMissingSource',
'headers' ],
38 $status = StatusValue::newGood();
41 $srcExists = $this->
fileExists( $this->params[
'src'], $predicates );
42 if ( $srcExists ===
false ) {
43 if ( $this->
getParam(
'ignoreMissingSource' ) ) {
44 $this->doOperation =
false;
46 $predicates[
'exists'][$this->params[
'src']] =
false;
47 $predicates[
'sha1'][$this->params[
'src']] =
false;
51 $status->fatal(
'backend-fail-notexists', $this->params[
'src'] );
55 } elseif ( $srcExists === FileBackend::EXISTENCE_ERROR ) {
56 $status->fatal(
'backend-fail-stat', $this->params[
'src'] );
63 if ( $status->isOK() ) {
65 $predicates[
'exists'][$this->params[
'src']] =
false;
66 $predicates[
'sha1'][$this->params[
'src']] =
false;
67 $predicates[
'exists'][$this->params[
'dst']] =
true;
75 if ( $this->overwriteSameCase ) {
76 if ( $this->params[
'src'] === $this->params[
'dst'] ) {
78 $status = StatusValue::newGood();
81 $status = $this->backend->deleteInternal( $this->
setFlags(
82 [
'src' => $this->params[
'src'] ]
85 } elseif ( $this->params[
'src'] === $this->params[
'dst'] ) {
87 $headers = $this->
getParam(
'headers' ) ?: [];
88 $status = $this->backend->describeInternal( $this->
setFlags(
89 [
'src' => $this->params[
'dst'],
'headers' => $headers ]
93 $status = $this->backend->moveInternal( $this->
setFlags( $this->params ) );
100 return [ $this->params[
'src'] ];
104 return [ $this->params[
'src'], $this->params[
'dst'] ];
FileBackend helper class for representing operations.
fileExists( $source, array $predicates)
Check if a file will exist in storage when this operation is attempted.
getParam( $name)
Get the value of the parameter with the given name.
setFlags(array $params)
Adjust params to FileBackendStore internal file calls.
precheckDestExistence(array $predicates)
Check for errors with regards to the destination file already existing.
Move a file from one storage path to another in the backend.
doPrecheck(array &$predicates)
storagePathsRead()
Get a list of storage paths read from for this operation.
allowedParams()
Get the file operation parameters.
storagePathsChanged()
Get a list of storage paths written to for this operation.