MediaWiki REL1_35
FileContentsHasher Class Reference
Collaboration diagram for FileContentsHasher:

Public Member Functions

 __construct ()
 

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
 

Private Member Functions

 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 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.

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 88 of file FileContentsHasher.php.

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

Referenced by TemplateParser\compile(), ResourceLoaderFileModule\compileLessString(), ResourceLoaderFileModule\getFileHashes(), TemplateParser\getTemplate(), and ResourceLoaderModule\safeFileHash().

◆ getFileContentsHashInternal()

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

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.

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 55 of file FileContentsHasher.php.

Referenced by getFileContentsHash().

◆ 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: