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[
'dst']] =
true;
73 if ( $this->overwriteSameCase ) {
74 $status = StatusValue::newGood();
75 } elseif ( $this->params[
'src'] === $this->params[
'dst'] ) {
77 $headers = $this->
getParam(
'headers' ) ?: [];
78 $status = $this->backend->describeInternal( $this->
setFlags( [
79 'src' => $this->params[
'dst'],
'headers' => $headers
83 $status = $this->backend->copyInternal( $this->
setFlags( $this->params ) );
90 return [ $this->params[
'src'] ];
94 return [ $this->params[
'dst'] ];
Copy a file from one storage path to another in the backend.
doPrecheck(array &$predicates)
allowedParams()
Get the file operation parameters.
storagePathsChanged()
Get a list of storage paths written to for this operation.
storagePathsRead()
Get a list of storage paths read from for this operation.
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.