/**
* Check preconditions of the operation without writing anything.
* This must update $predicates for each path that the op can change
- * except when a failing status object is returned.
+ * except when a failing StatusValue object is returned.
*
* @param array $predicates
- * @return Status
+ * @return StatusValue
*/
final public function precheck( array &$predicates ) {
if ( $this->state !== self::STATE_NEW ) {
- return Status::newFatal( 'fileop-fail-state', self::STATE_NEW, $this->state );
+ return StatusValue::newFatal( 'fileop-fail-state', self::STATE_NEW, $this->state );
}
$this->state = self::STATE_CHECKED;
$status = $this->doPrecheck( $predicates );
/**
* @param array $predicates
- * @return Status
+ * @return StatusValue
*/
protected function doPrecheck( array &$predicates ) {
- return Status::newGood();
+ return StatusValue::newGood();
}
/**
* Attempt the operation
*
- * @return Status
+ * @return StatusValue
*/
final public function attempt() {
if ( $this->state !== self::STATE_CHECKED ) {
- return Status::newFatal( 'fileop-fail-state', self::STATE_CHECKED, $this->state );
+ return StatusValue::newFatal( 'fileop-fail-state', self::STATE_CHECKED, $this->state );
} elseif ( $this->failed ) { // failed precheck
- return Status::newFatal( 'fileop-fail-attempt-precheck' );
+ return StatusValue::newFatal( 'fileop-fail-attempt-precheck' );
}
$this->state = self::STATE_ATTEMPTED;
if ( $this->doOperation ) {
$this->logFailure( 'attempt' );
}
} else { // no-op
- $status = Status::newGood();
+ $status = StatusValue::newGood();
}
return $status;
}
/**
- * @return Status
+ * @return StatusValue
*/
protected function doAttempt() {
- return Status::newGood();
+ return StatusValue::newGood();
}
/**
* Attempt the operation in the background
*
- * @return Status
+ * @return StatusValue
*/
final public function attemptAsync() {
$this->async = true;
/**
* Check for errors with regards to the destination file already existing.
* Also set the destExists, overwriteSameCase and sourceSha1 member variables.
- * A bad status will be returned if there is no chance it can be overwritten.
+ * A bad StatusValue will be returned if there is no chance it can be overwritten.
*
* @param array $predicates
- * @return Status
+ * @return StatusValue
*/
protected function precheckDestExistence( array $predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Get hash of source file/string and the destination file
$this->sourceSha1 = $this->getSourceSha1Base36(); // FS file or data string
if ( $this->sourceSha1 === null ) { // file in storage?
}
protected function doPrecheck( array &$predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Check if the source data is too big
if ( strlen( $this->getParam( 'content' ) ) > $this->backend->maxFileSizeInternal() ) {
$status->fatal( 'backend-fail-maxsize',
return $this->backend->createInternal( $this->setFlags( $this->params ) );
}
- return Status::newGood();
+ return StatusValue::newGood();
}
protected function getSourceSha1Base36() {
}
protected function doPrecheck( array &$predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Check if the source file exists on the file system
if ( !is_file( $this->params['src'] ) ) {
$status->fatal( 'backend-fail-notexists', $this->params['src'] );
return $this->backend->storeInternal( $this->setFlags( $this->params ) );
}
- return Status::newGood();
+ return StatusValue::newGood();
}
protected function getSourceSha1Base36() {
}
protected function doPrecheck( array &$predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Check if the source file exists
if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
if ( $this->getParam( 'ignoreMissingSource' ) ) {
protected function doAttempt() {
if ( $this->overwriteSameCase ) {
- $status = Status::newGood(); // nothing to do
+ $status = StatusValue::newGood(); // nothing to do
} elseif ( $this->params['src'] === $this->params['dst'] ) {
// Just update the destination file headers
$headers = $this->getParam( 'headers' ) ?: [];
}
protected function doPrecheck( array &$predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Check if the source file exists
if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
if ( $this->getParam( 'ignoreMissingSource' ) ) {
if ( $this->overwriteSameCase ) {
if ( $this->params['src'] === $this->params['dst'] ) {
// Do nothing to the destination (which is also the source)
- $status = Status::newGood();
+ $status = StatusValue::newGood();
} else {
// Just delete the source as the destination file needs no changes
$status = $this->backend->deleteInternal( $this->setFlags(
}
protected function doPrecheck( array &$predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Check if the source file exists
if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
if ( $this->getParam( 'ignoreMissingSource' ) ) {
}
protected function doPrecheck( array &$predicates ) {
- $status = Status::newGood();
+ $status = StatusValue::newGood();
// Check if the source file exists
if ( !$this->fileExists( $this->params['src'], $predicates ) ) {
$status->fatal( 'backend-fail-notexists', $this->params['src'] );