From: Aaron Schulz Date: Tue, 11 Dec 2018 19:58:35 +0000 (-0500) Subject: filebackend: simplify code in FileBackendStore::getFileStat slightly X-Git-Tag: 1.34.0-rc.0~3265^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=017f4a0171d5d25879a157b330cfd3d1f1063b0b;p=lhc%2Fweb%2Fwiklou.git filebackend: simplify code in FileBackendStore::getFileStat slightly Change-Id: Ic888192b592a62f316fa076678a9fcef9bb8553b --- diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index 33afe650b9..28a293f7d2 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -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; } }