MediaWiki REL1_33
FileContentsHasher Class Reference
Collaboration diagram for FileContentsHasher:

Public Member Functions

 __construct ()
 
 getFileContentsHashInternal ( $filePath, $algo='md4')
 Get a hash of a file's contents, either by retrieving a previously- computed hash from the cache, or by computing a hash from the file.
 

Static Public Member Functions

static getFileContentsHash ( $filePaths, $algo='md4')
 Get a hash of the combined contents of one or more files, either by retrieving a previously-computed hash from the cache, or by computing a hash from the files.
 
static singleton ()
 Get the singleton instance of this class.
 

Protected Attributes

BagOStuff $cache
 

Static Private Attributes

static FileContentsHasher $instance
 

Detailed Description

Definition at line 22 of file FileContentsHasher.php.

Constructor & Destructor Documentation

◆ __construct()

FileContentsHasher::__construct ( )

Definition at line 30 of file FileContentsHasher.php.

References cache.

Member Function Documentation

◆ getFileContentsHash()

static FileContentsHasher::getFileContentsHash ( $filePaths,
$algo = 'md4' )
static

Get a hash of the combined contents of one or more files, either by retrieving a previously-computed hash from the cache, or by computing a hash from the files.

Parameters
string | string[]$filePathsOne or more file paths.
string$algoName of selected hashing algorithm.
Returns
string|bool Hash of files' contents, or false if no file could not be read.

Definition at line 89 of file FileContentsHasher.php.

References $hashes, $instance, and(), array(), and singleton().

Referenced by ResourceLoaderFileModule\compileLessFile(), ResourceLoaderModule\safeFileHash(), FileContentsHasherTest\testMultipleFileHash(), and FileContentsHasherTest\testSingleFileHash().

◆ getFileContentsHashInternal()

FileContentsHasher::getFileContentsHashInternal ( $filePath,
$algo = 'md4' )

Get a hash of a file's contents, either by retrieving a previously- computed hash from the cache, or by computing a hash from the file.

Access:\n private
Parameters
string$filePathFull path to the file.
string$algoName of selected hashing algorithm.
Returns
string|bool Hash of file contents, or false if the file could not be read.

Definition at line 56 of file FileContentsHasher.php.

References and(), and cache.

◆ singleton()

static FileContentsHasher::singleton ( )
static

Get the singleton instance of this class.

Returns
FileContentsHasher

Definition at line 39 of file FileContentsHasher.php.

References $instance.

Referenced by getFileContentsHash().

Member Data Documentation

◆ $cache

BagOStuff FileContentsHasher::$cache
protected

Definition at line 25 of file FileContentsHasher.php.

◆ $instance

FileContentsHasher FileContentsHasher::$instance
staticprivate

Definition at line 28 of file FileContentsHasher.php.

Referenced by getFileContentsHash(), and singleton().


The documentation for this class was generated from the following file: