13use Wikimedia\AtEase\AtEase;
24 [
'overwrite',
'overwriteSame',
'headers' ],
34 $status = StatusValue::newGood();
37 if ( !is_file( $this->params[
'src'] ) ) {
38 $status->fatal(
'backend-fail-notexists', $this->params[
'src'] );
44 $maxFileSize = $this->backend->maxFileSizeInternal();
45 if ( $sourceSize > $maxFileSize ) {
46 $status->fatal(
'backend-fail-maxsize', $this->params[
'dst'], $maxFileSize );
51 $sourceSha1 =
function () {
60 if ( $status->isOK() ) {
61 $batchPredicates->
assumeFileExists( $this->params[
'dst'], $sourceSize, $sourceSha1 );
69 if ( $this->overwriteSameCase ) {
70 $status = StatusValue::newGood();
73 $status = $this->backend->storeInternal( $this->
setFlags( $this->params ) );
80 AtEase::suppressWarnings();
81 $size = filesize( $this->params[
'src'] );
82 AtEase::restoreWarnings();
88 AtEase::suppressWarnings();
89 $hash = sha1_file( $this->params[
'src'] );
90 AtEase::restoreWarnings();
91 if ( $hash !==
false ) {
92 $hash = \Wikimedia\base_convert( $hash, 16, 36, 31 );
100 return [ $this->params[
'dst'] ];
105class_alias( StoreFileOp::class,
'StoreFileOp' );
Generic operation result class Has warning/error list, boolean status and arbitrary value.