Add missing "@return StatusValue" to all abstract do… methods
[lhc/web/wiklou.git] / includes / libs / filebackend / FileBackend.php
index 2852265..178831b 100644 (file)
@@ -427,7 +427,7 @@ abstract class FileBackend implements LoggerAwareInterface {
                }
 
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+               $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
 
                return $this->doOperationsInternal( $ops, $opts );
        }
@@ -436,6 +436,7 @@ abstract class FileBackend implements LoggerAwareInterface {
         * @see FileBackend::doOperations()
         * @param array $ops
         * @param array $opts
+        * @return StatusValue
         */
        abstract protected function doOperationsInternal( array $ops, array $opts );
 
@@ -665,7 +666,7 @@ abstract class FileBackend implements LoggerAwareInterface {
                }
 
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+               $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
 
                return $this->doQuickOperationsInternal( $ops );
        }
@@ -673,6 +674,7 @@ abstract class FileBackend implements LoggerAwareInterface {
        /**
         * @see FileBackend::doQuickOperations()
         * @param array $ops
+        * @return StatusValue
         * @since 1.20
         */
        abstract protected function doQuickOperationsInternal( array $ops );
@@ -812,13 +814,14 @@ abstract class FileBackend implements LoggerAwareInterface {
                        return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+               $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
                return $this->doPrepare( $params );
        }
 
        /**
         * @see FileBackend::prepare()
         * @param array $params
+        * @return StatusValue
         */
        abstract protected function doPrepare( array $params );
 
@@ -843,13 +846,14 @@ abstract class FileBackend implements LoggerAwareInterface {
                        return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+               $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
                return $this->doSecure( $params );
        }
 
        /**
         * @see FileBackend::secure()
         * @param array $params
+        * @return StatusValue
         */
        abstract protected function doSecure( array $params );
 
@@ -876,13 +880,14 @@ abstract class FileBackend implements LoggerAwareInterface {
                        return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+               $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
                return $this->doPublish( $params );
        }
 
        /**
         * @see FileBackend::publish()
         * @param array $params
+        * @return StatusValue
         */
        abstract protected function doPublish( array $params );
 
@@ -902,34 +907,17 @@ abstract class FileBackend implements LoggerAwareInterface {
                        return $this->newStatus( 'backend-fail-readonly', $this->name, $this->readOnly );
                }
                /** @noinspection PhpUnusedLocalVariableInspection */
-               $scope = $this->getScopedPHPBehaviorForOps(); // try to ignore client aborts
+               $scope = ScopedCallback::newScopedIgnoreUserAbort(); // try to ignore client aborts
                return $this->doClean( $params );
        }
 
        /**
         * @see FileBackend::clean()
         * @param array $params
+        * @return StatusValue
         */
        abstract protected function doClean( array $params );
 
-       /**
-        * Enter file operation scope.
-        * This just makes PHP ignore user aborts/disconnects until the return
-        * value leaves scope. This returns null and does nothing in CLI mode.
-        *
-        * @return ScopedCallback|null
-        */
-       final protected function getScopedPHPBehaviorForOps() {
-               if ( PHP_SAPI != 'cli' ) { // https://bugs.php.net/bug.php?id=47540
-                       $old = ignore_user_abort( true ); // avoid half-finished operations
-                       return new ScopedCallback( function () use ( $old ) {
-                               ignore_user_abort( $old );
-                       } );
-               }
-
-               return null;
-       }
-
        /**
         * Check if a file exists at a storage path in the backend.
         * This returns false if only a directory exists at the path.