Make Status extend StatusValue and start FileBackend update
[lhc/web/wiklou.git] / includes / filebackend / lockmanager / FSLockManager.php
index bce6b34..8e149d6 100644 (file)
  */
 class FSLockManager extends LockManager {
        /** @var array Mapping of lock types to the type actually used */
-       protected $lockTypeMap = array(
+       protected $lockTypeMap = [
                self::LOCK_SH => self::LOCK_SH,
                self::LOCK_UW => self::LOCK_SH,
                self::LOCK_EX => self::LOCK_EX
-       );
+       ];
 
        protected $lockDir; // global dir for all servers
 
        /** @var array Map of (locked key => lock file handle) */
-       protected $handles = array();
+       protected $handles = [];
 
        /**
         * Construct a new instance from configuration.
@@ -62,12 +62,12 @@ class FSLockManager extends LockManager {
         * @see LockManager::doLock()
         * @param array $paths
         * @param int $type
-        * @return Status
+        * @return StatusValue
         */
        protected function doLock( array $paths, $type ) {
                $status = Status::newGood();
 
-               $lockedPaths = array(); // files locked in this attempt
+               $lockedPaths = []; // files locked in this attempt
                foreach ( $paths as $path ) {
                        $status->merge( $this->doSingleLock( $path, $type ) );
                        if ( $status->isOK() ) {
@@ -87,7 +87,7 @@ class FSLockManager extends LockManager {
         * @see LockManager::doUnlock()
         * @param array $paths
         * @param int $type
-        * @return Status
+        * @return StatusValue
         */
        protected function doUnlock( array $paths, $type ) {
                $status = Status::newGood();
@@ -104,7 +104,7 @@ class FSLockManager extends LockManager {
         *
         * @param string $path
         * @param int $type
-        * @return Status
+        * @return StatusValue
         */
        protected function doSingleLock( $path, $type ) {
                $status = Status::newGood();
@@ -117,9 +117,9 @@ class FSLockManager extends LockManager {
                        if ( isset( $this->handles[$path] ) ) {
                                $handle = $this->handles[$path];
                        } else {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $handle = fopen( $this->getLockPath( $path ), 'a+' );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                                if ( !$handle ) { // lock dir missing?
                                        wfMkdirParents( $this->lockDir );
                                        $handle = fopen( $this->getLockPath( $path ), 'a+' ); // try again
@@ -149,7 +149,7 @@ class FSLockManager extends LockManager {
         *
         * @param string $path
         * @param int $type
-        * @return Status
+        * @return StatusValue
         */
        protected function doSingleUnlock( $path, $type ) {
                $status = Status::newGood();
@@ -159,7 +159,7 @@ class FSLockManager extends LockManager {
                } elseif ( !isset( $this->locksHeld[$path][$type] ) ) {
                        $status->warning( 'lockmanager-notlocked', $path );
                } else {
-                       $handlesToClose = array();
+                       $handlesToClose = [];
                        --$this->locksHeld[$path][$type];
                        if ( $this->locksHeld[$path][$type] <= 0 ) {
                                unset( $this->locksHeld[$path][$type] );
@@ -192,7 +192,7 @@ class FSLockManager extends LockManager {
        /**
         * @param string $path
         * @param array $handlesToClose
-        * @return Status
+        * @return StatusValue
         */
        private function closeLockHandles( $path, array $handlesToClose ) {
                $status = Status::newGood();
@@ -210,7 +210,7 @@ class FSLockManager extends LockManager {
 
        /**
         * @param string $path
-        * @return Status
+        * @return StatusValue
         */
        private function pruneKeyLockFiles( $path ) {
                $status = Status::newGood();