24use Wikimedia\AtEase\AtEase;
34 [
'overwrite',
'overwriteSame',
'headers' ],
40 $status = StatusValue::newGood();
43 if ( !is_file( $this->params[
'src'] ) ) {
44 $status->fatal(
'backend-fail-notexists', $this->params[
'src'] );
49 $maxBytes = $this->backend->maxFileSizeInternal();
50 if ( filesize( $this->params[
'src'] ) > $maxBytes ) {
51 $status->fatal(
'backend-fail-maxsize', $this->params[
'dst'], $maxBytes );
60 if ( $status->isOK() ) {
70 if ( $this->overwriteSameCase ) {
71 $status = StatusValue::newGood();
74 $status = $this->backend->storeInternal( $this->
setFlags( $this->params ) );
81 AtEase::suppressWarnings();
82 $size = filesize( $this->params[
'src'] );
83 AtEase::restoreWarnings();
89 AtEase::suppressWarnings();
90 $hash = sha1_file( $this->params[
'src'] );
91 AtEase::restoreWarnings();
92 if ( $hash !==
false ) {
93 $hash = Wikimedia\base_convert( $hash, 16, 36, 31 );
100 return [ $this->params[
'dst'] ];
FileBackend helper class for representing operations.
setFlags(array $params)
Adjust params to FileBackendStore internal file calls.
precheckDestExistence(array $predicates)
Check for errors with regards to the destination file already existing.
Store a file into the backend from a file on the file system.
getSourceSha1Base36()
precheckDestExistence() helper function to get the source file SHA-1.
doPrecheck(array &$predicates)
allowedParams()
Get the file operation parameters.
getSourceSize()
precheckDestExistence() helper function to get the source file size.
storagePathsChanged()
Get a list of storage paths written to for this operation.