* @return string|bool Hash of file contents, or false if the file could not be read.
*/
public function getFileContentsHashInternal( $filePath, $algo = 'md4' ) {
- $mtime = MediaWiki\quietCall( 'filemtime', $filePath );
+ $mtime = filemtime( $filePath );
if ( $mtime === false ) {
return false;
}
return $hash;
}
- $contents = MediaWiki\quietCall( 'file_get_contents', $filePath );
+ $contents = file_get_contents( $filePath );
if ( $contents === false ) {
return false;
}
$filePaths = (array)$filePaths;
}
+ MediaWiki\suppressWarnings();
+
if ( count( $filePaths ) === 1 ) {
- return $instance->getFileContentsHashInternal( $filePaths[0], $algo );
+ $hash = $instance->getFileContentsHashInternal( $filePaths[0], $algo );
+ MediaWiki\restoreWarnings();
+ return $hash;
}
sort( $filePaths );
return $instance->getFileContentsHashInternal( $filePath, $algo ) ?: '';
}, $filePaths );
+ MediaWiki\restoreWarnings();
+
$hashes = implode( '', $hashes );
return $hashes ? hash( $algo, $hashes ) : false;
}