return $status; // safe to call attempt()
}
- /**
- * @return Status
- */
protected function doAttempt() {
if ( !$this->overwriteSameCase ) {
// Create the file at the destination
return Status::newGood();
}
- /**
- * @return bool|String
- */
protected function getSourceSha1Base36() {
return wfBaseConvert( sha1( $this->params['content'] ), 16, 36, 31 );
}
- /**
- * @return array
- */
public function storagePathsChanged() {
return array( $this->params['dst'] );
}
* Parameters for this operation are outlined in FileBackend::doOperations().
*/
class StoreFileOp extends FileOp {
- /**
- * @return array
- */
protected function allowedParams() {
return array( array( 'src', 'dst' ),
array( 'overwrite', 'overwriteSame', 'headers' ) );
}
- /**
- * @param $predicates array
- * @return Status
- */
protected function doPrecheck( array &$predicates ) {
$status = Status::newGood();
// Check if the source file exists on the file system
return $status; // safe to call attempt()
}
- /**
- * @return Status
- */
protected function doAttempt() {
if ( !$this->overwriteSameCase ) {
// Store the file at the destination
return Status::newGood();
}
- /**
- * @return bool|string
- */
protected function getSourceSha1Base36() {
wfSuppressWarnings();
$hash = sha1_file( $this->params['src'] );
* Parameters for this operation are outlined in FileBackend::doOperations().
*/
class CopyFileOp extends FileOp {
- /**
- * @return array
- */
protected function allowedParams() {
return array( array( 'src', 'dst' ),
array( 'overwrite', 'overwriteSame', 'ignoreMissingSource', 'headers' ) );
}
- /**
- * @param $predicates array
- * @return Status
- */
protected function doPrecheck( array &$predicates ) {
$status = Status::newGood();
// Check if the source file exists
return $status; // safe to call attempt()
}
- /**
- * @return Status
- */
protected function doAttempt() {
if ( $this->overwriteSameCase ) {
$status = Status::newGood(); // nothing to do
return $status;
}
- /**
- * @return array
- */
public function storagePathsRead() {
return array( $this->params['src'] );
}
- /**
- * @return array
- */
public function storagePathsChanged() {
return array( $this->params['dst'] );
}
* Parameters for this operation are outlined in FileBackend::doOperations().
*/
class MoveFileOp extends FileOp {
- /**
- * @return array
- */
protected function allowedParams() {
return array( array( 'src', 'dst' ),
array( 'overwrite', 'overwriteSame', 'ignoreMissingSource', 'headers' ) );
}
- /**
- * @param $predicates array
- * @return Status
- */
protected function doPrecheck( array &$predicates ) {
$status = Status::newGood();
// Check if the source file exists
return $status; // safe to call attempt()
}
- /**
- * @return Status
- */
protected function doAttempt() {
if ( $this->overwriteSameCase ) {
if ( $this->params['src'] === $this->params['dst'] ) {
return $status;
}
- /**
- * @return array
- */
public function storagePathsRead() {
return array( $this->params['src'] );
}
- /**
- * @return array
- */
public function storagePathsChanged() {
return array( $this->params['src'], $this->params['dst'] );
}
* Parameters for this operation are outlined in FileBackend::doOperations().
*/
class DeleteFileOp extends FileOp {
- /**
- * @return array
- */
protected function allowedParams() {
return array( array( 'src' ), array( 'ignoreMissingSource' ) );
}
- /**
- * @param $predicates array
- * @return Status
- */
protected function doPrecheck( array &$predicates ) {
$status = Status::newGood();
// Check if the source file exists
return $status; // safe to call attempt()
}
- /**
- * @return Status
- */
protected function doAttempt() {
// Delete the source file
return $this->backend->deleteInternal( $this->setFlags( $this->params ) );
}
- /**
- * @return array
- */
public function storagePathsChanged() {
return array( $this->params['src'] );
}
* Parameters for this operation are outlined in FileBackend::doOperations().
*/
class DescribeFileOp extends FileOp {
- /**
- * @return array
- */
protected function allowedParams() {
return array( array( 'src' ), array( 'headers' ) );
}
- /**
- * @param $predicates array
- * @return Status
- */
protected function doPrecheck( array &$predicates ) {
$status = Status::newGood();
// Check if the source file exists
return $status; // safe to call attempt()
}
- /**
- * @return Status
- */
protected function doAttempt() {
// Update the source file's metadata
return $this->backend->describeInternal( $this->setFlags( $this->params ) );
}
- /**
- * @return array
- */
public function storagePathsChanged() {
return array( $this->params['src'] );
}