X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Ffilebackend%2FFileBackendStore.php;h=9b901dd1d1be7218f93688591988d25d757db44c;hb=b5fc03a7bfe46f434e332613c477e0ce9fe50e09;hp=e2a25fcd51971d3373877bca51d4dd571871814a;hpb=4d393de9d87c21a4cc79ecf44ecd16bd1b4dd9e0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index e2a25fcd51..9b901dd1d1 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -20,6 +20,7 @@ * @file * @ingroup FileBackend */ +use Wikimedia\AtEase\AtEase; use Wikimedia\Timestamp\ConvertibleTimestamp; /** @@ -376,9 +377,9 @@ abstract class FileBackendStore extends FileBackend { unset( $params['latest'] ); // sanity // Check that the specified temp file is valid... - Wikimedia\suppressWarnings(); + AtEase::suppressWarnings(); $ok = ( is_file( $tmpPath ) && filesize( $tmpPath ) == 0 ); - Wikimedia\restoreWarnings(); + AtEase::restoreWarnings(); if ( !$ok ) { // not present or not empty $status->fatal( 'backend-fail-opentemp', $tmpPath ); @@ -603,7 +604,7 @@ abstract class FileBackendStore extends FileBackend { $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" ); $stat = $this->getFileStat( $params ); - return ( $stat === null ) ? null : (bool)$stat; // null => failure + return ( $stat === self::UNKNOWN ) ? self::UNKNOWN : (bool)$stat; } final public function getFileTimestamp( array $params ) { @@ -636,7 +637,7 @@ abstract class FileBackendStore extends FileBackend { // cache entries from mass object listings that do not include the SHA-1. In that // case, loading the persistent stat cache will likely yield the SHA-1. if ( - $stat === null || + $stat === self::UNKNOWN || ( $requireSHA1 && is_array( $stat ) && !isset( $stat['sha1'] ) ) ) { $this->primeFileCache( [ $path ] ); // check persistent cache @@ -714,9 +715,9 @@ abstract class FileBackendStore extends FileBackend { protected function doGetFileContentsMulti( array $params ) { $contents = []; foreach ( $this->doGetLocalReferenceMulti( $params ) as $path => $fsFile ) { - Wikimedia\suppressWarnings(); + AtEase::suppressWarnings(); $contents[$path] = $fsFile ? file_get_contents( $fsFile->getPath() ) : false; - Wikimedia\restoreWarnings(); + AtEase::restoreWarnings(); } return $contents; @@ -935,7 +936,7 @@ abstract class FileBackendStore extends FileBackend { $res = true; break; // found one! } elseif ( $exists === null ) { // error? - $res = null; // if we don't find anything, it is indeterminate + $res = self::UNKNOWN; // if we don't find anything, it is indeterminate } } @@ -956,7 +957,7 @@ abstract class FileBackendStore extends FileBackend { final public function getDirectoryList( array $params ) { list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { // invalid storage path - return null; + return self::UNKNOWN; } if ( $shard !== null ) { // File listing is confined to a single container/shard @@ -986,7 +987,7 @@ abstract class FileBackendStore extends FileBackend { final public function getFileList( array $params ) { list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); if ( $dir === null ) { // invalid storage path - return null; + return self::UNKNOWN; } if ( $shard !== null ) { // File listing is confined to a single container/shard