filebackend: simplify code in FileBackendStore::getFileStat slightly
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 11 Dec 2018 19:58:35 +0000 (14:58 -0500)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 11 Dec 2018 19:58:35 +0000 (14:58 -0500)
Change-Id: Ic888192b592a62f316fa076678a9fcef9bb8553b

includes/libs/filebackend/FileBackendStore.php

index 33afe65..28a293f 100644 (file)
@@ -644,20 +644,18 @@ abstract class FileBackendStore extends FileBackend {
                }
 
                $stat = $this->cheapCache->getField( $path, 'stat', self::CACHE_TTL );
-               if ( $stat !== null ) {
-                       // If we want the latest data, check that this cached
-                       // value was in fact fetched with the latest available data.
-                       if ( is_array( $stat ) ) {
-                               if (
-                                       ( !$latest || $stat['latest'] ) &&
-                                       ( !$requireSHA1 || isset( $stat['sha1'] ) )
-                               ) {
-                                       return $stat;
-                               }
-                       } elseif ( in_array( $stat, [ 'NOT_EXIST', 'NOT_EXIST_LATEST' ] ) ) {
-                               if ( !$latest || $stat === 'NOT_EXIST_LATEST' ) {
-                                       return false;
-                               }
+               // If we want the latest data, check that this cached
+               // value was in fact fetched with the latest available data.
+               if ( is_array( $stat ) ) {
+                       if (
+                               ( !$latest || $stat['latest'] ) &&
+                               ( !$requireSHA1 || isset( $stat['sha1'] ) )
+                       ) {
+                               return $stat;
+                       }
+               } elseif ( in_array( $stat, [ 'NOT_EXIST', 'NOT_EXIST_LATEST' ], true ) ) {
+                       if ( !$latest || $stat === 'NOT_EXIST_LATEST' ) {
+                               return false;
                        }
                }