CInbox (Common-Inbox)  0.1
Common functionality for ingesting files for archiving.
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
TaskHash Class Reference
Inheritance diagram for TaskHash:
CITask TaskHashGenerate TaskHashOutput TaskHashSearch TaskHashValidate

List of all members.

Public Member Functions

 __construct (&$CIFolder)
 loadHashFromFile ($fileName)
 getTempHashForFilename ($fileName)
 getHashTypesAllowed ()

Static Public Member Functions

static getHashTempFilename ($fileName, $CIFolder, $hashType)
static removeHashTempFile ($fileName, $CIFolder, $hashType)

Public Attributes

const TASK_LABEL = 'Hash Base (abstract)'
const CONF_HASH_TYPE = 'HASH_TYPE'

Protected Member Functions

 loadSettings ()
 saveHashToFile ($fileName, $hashCode)
 getTempHashForFolder ($folderName)
 hashTypeIsAllowed ($hashType)
 generateHashcode ($hashType, $fileName)
 compareHashcode ($hash1, $hash2)

Protected Attributes

 $hashType

Detailed Description

Abstract base class for hashcode-related tasks. Provides common methods useful for handling hashcodes as well as read/writing their temp files.

Author:
Peter Bubestinger-Steindl (pb@av-rd.com)
See also:

Member Function Documentation

TaskHash::compareHashcode ( hash1,
hash2 
) [protected]

Checks if $hash1 matches $hash2. Comparison is case insensitive.

TaskHash::generateHashcode ( hashType,
fileName 
) [protected]

Generates a hashcode for a file.

static TaskHash::getHashTempFilename ( fileName,
CIFolder,
hashType 
) [static]

Returns the filename where the hashcode is temporarily stored for $fileName. This method is static, so it can be used by other tasks to determine where to find the temporary hashcode files.

Returns an array containing the hash algorithm types allowed/supported.

Returns the hashcode from pre-calculated temp hashfiles. Requires TaskHashGenerate to be run before.

TaskHash::getTempHashForFolder ( folderName) [protected]

Returns an array with hashcodes of all files in the given folder. Hashcodes are read from temp-hashfiles. Array structure is: key: filename (absolute) value: hashcode

TaskHash::hashTypeIsAllowed ( hashType) [protected]

Checks if provided hashtype is supported by this task. By default, all hash algorithms supported by PHP are allowed.

TaskHash::loadHashFromFile ( fileName)

Reads the hashcode from a file. The format of the file must match the format that "saveHashToFile" writes. Returns the hashcode in lowercase.

TaskHash::loadSettings ( ) [protected]

Load settings from config that are relevant for this task.

Reimplemented from CITask.

Reimplemented in TaskHashOutput, and TaskHashSearch.

static TaskHash::removeHashTempFile ( fileName,
CIFolder,
hashType 
) [static]

Deletes the file where the hashcode is temporarily stored for $fileName. This method is static, so it can be used by other tasks to remove the temporary hashcode files.

TaskHash::saveHashToFile ( fileName,
hashCode 
) [protected]

Writes the hascode to a file.

Hashcode is forced to lowercase. Default format: Plain text. Just the hashcode and a newline (
) character. Nothing else.


The documentation for this class was generated from the following file:
 All Classes Functions Variables