27use Wikimedia\AtEase\AtEase;
37 [
'overwrite',
'overwriteSame',
'headers' ],
46 $status = StatusValue::newGood();
49 if ( !is_file( $this->params[
'src'] ) ) {
50 $status->fatal(
'backend-fail-notexists', $this->params[
'src'] );
56 $maxFileSize = $this->backend->maxFileSizeInternal();
57 if ( $sourceSize > $maxFileSize ) {
58 $status->fatal(
'backend-fail-maxsize', $this->params[
'dst'], $maxFileSize );
63 $sourceSha1 =
function () {
72 if ( $status->isOK() ) {
73 $batchPredicates->
assumeFileExists( $this->params[
'dst'], $sourceSize, $sourceSha1 );
80 if ( $this->overwriteSameCase ) {
81 $status = StatusValue::newGood();
84 $status = $this->backend->storeInternal( $this->
setFlags( $this->params ) );
91 AtEase::suppressWarnings();
92 $size = filesize( $this->params[
'src'] );
93 AtEase::restoreWarnings();
99 AtEase::suppressWarnings();
100 $hash = sha1_file( $this->params[
'src'] );
101 AtEase::restoreWarnings();
102 if ( $hash !==
false ) {
103 $hash = \Wikimedia\base_convert( $hash, 16, 36, 31 );
110 return [ $this->params[
'dst'] ];
115class_alias( StoreFileOp::class,
'StoreFileOp' );
Generic operation result class Has warning/error list, boolean status and arbitrary value.