- if ( $this->cheapCache->hasField( $path, 'stat', self::CACHE_TTL ) ) {
- $stat = $this->cheapCache->getField( $path, 'stat' );
- // 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'] ) {
- return $stat;
- }
- } elseif ( in_array( $stat, [ 'NOT_EXIST', 'NOT_EXIST_LATEST' ] ) ) {
- if ( !$latest || $stat === 'NOT_EXIST_LATEST' ) {
- return false;
- }
+
+ $stat = $this->cheapCache->getField( $path, 'stat', self::CACHE_TTL );
+ // 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;