Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / filerepo / backend / FileOp.php
index b2b46ed..d9fbafd 100644 (file)
@@ -438,10 +438,18 @@ abstract class FileOp {
  *     overwriteSame : override any existing file at destination
  */
 class StoreFileOp extends FileOp {
+
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src', 'dst' ), array( 'overwrite', 'overwriteSame' ) );
        }
 
+       /**
+        * @param $predicates array
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists on the file system
@@ -470,6 +478,9 @@ class StoreFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                // Store the file at the destination
                if ( !$this->destSameAsSource ) {
@@ -478,6 +489,9 @@ class StoreFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return bool|string
+        */
        protected function getSourceSha1Base36() {
                wfSuppressWarnings();
                $hash = sha1_file( $this->params['src'] );
@@ -530,6 +544,9 @@ class CreateFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                if ( !$this->destSameAsSource ) {
                        // Create the file at the destination
@@ -538,10 +555,16 @@ class CreateFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return bool|String
+        */
        protected function getSourceSha1Base36() {
                return wfBaseConvert( sha1( $this->params['content'] ), 16, 36, 31 );
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['dst'] );
        }
@@ -556,10 +579,18 @@ class CreateFileOp extends FileOp {
  *     overwriteSame : override any existing file at destination
  */
 class CopyFileOp extends FileOp {
+
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src', 'dst' ), array( 'overwrite', 'overwriteSame' ) );
        }
 
+       /**
+        * @param $predicates array
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists
@@ -582,6 +613,9 @@ class CopyFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                // Do nothing if the src/dst paths are the same
                if ( $this->params['src'] !== $this->params['dst'] ) {
@@ -593,10 +627,16 @@ class CopyFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsRead() {
                return array( $this->params['src'] );
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['dst'] );
        }
@@ -611,10 +651,17 @@ class CopyFileOp extends FileOp {
  *     overwriteSame : override any existing file at destination
  */
 class MoveFileOp extends FileOp {
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src', 'dst' ), array( 'overwrite', 'overwriteSame' ) );
        }
 
+       /**
+        * @param $predicates array
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists
@@ -639,6 +686,9 @@ class MoveFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                // Do nothing if the src/dst paths are the same
                if ( $this->params['src'] !== $this->params['dst'] ) {
@@ -654,10 +704,16 @@ class MoveFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsRead() {
                return array( $this->params['src'] );
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['src'], $this->params['dst'] );
        }
@@ -670,12 +726,19 @@ class MoveFileOp extends FileOp {
  *     ignoreMissingSource : don't return an error if the file does not exist
  */
 class DeleteFileOp extends FileOp {
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src' ), array( 'ignoreMissingSource' ) );
        }
 
        protected $needsDelete = true;
 
+       /**
+        * @param array $predicates
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists
@@ -692,6 +755,9 @@ class DeleteFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                if ( $this->needsDelete ) {
                        // Delete the source file
@@ -700,6 +766,9 @@ class DeleteFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['src'] );
        }