MediaWiki  1.28.1
FileContentsHasher Class Reference
Collaboration diagram for FileContentsHasher:

Public Member Functions

 __construct ()
 Constructor. More...
 
 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. More...
 

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. More...
 
static singleton ()
 Get the singleton instance of this class. More...
 

Protected Attributes

BagOStuff $cache
 

Static Private Attributes

static FileContentsHasher $instance
 

Detailed Description

Definition at line 22 of file FileContentsHasher.php.

Constructor & Destructor Documentation

FileContentsHasher::__construct ( )

Constructor.

Definition at line 33 of file FileContentsHasher.php.

References cache, and ObjectCache\getLocalServerInstance().

Member Function Documentation

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[]$filePaths One 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 92 of file FileContentsHasher.php.

References $hashes, array(), getFileContentsHashInternal(), and use.

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

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

References cache.

Referenced by getFileContentsHash().

static FileContentsHasher::singleton ( )
static

Get the singleton instance of this class.

Returns
FileContentsHasher

Definition at line 42 of file FileContentsHasher.php.

Member Data Documentation

BagOStuff FileContentsHasher::$cache
protected

Definition at line 25 of file FileContentsHasher.php.

FileContentsHasher FileContentsHasher::$instance
staticprivate

Definition at line 28 of file FileContentsHasher.php.


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