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

List of all members.

Public Member Functions

 __construct (&$CIFolder)
 init ()
 run ()

Public Attributes

const TASK_LABEL = 'Hashcode search'
const CONF_HASH_SEARCH = 'HASH_SEARCH'
const CONF_HASH_MUST_EXIST = 'HASH_MUST_EXIST'

Protected Member Functions

 loadSettings ()
 searchHashCodes ($sourceFolder)
 searchHashCode ($sourceFolder, $hashCode)
 findHashInFile ($fileName, $hashCode)
 checkMustExist ($filesMatched)

Protected Attributes

 $hashSearch
 $hashMustExist

Detailed Description

For files matching 'HASH_MUST_EXIST', this task searches for existing hashes in files matching 'HASH_SEARCH' in the source folder in order to compare the current hashcode against it.

This allows to validate already existing hashes to document the chain of file transfer. It must be run *after* TaskHashGenerate, because the hashcodes are read from the temp-files created in that task.

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

Member Function Documentation

TaskHashSearch::checkMustExist ( filesMatched) [protected]

Checks if all files in "$filesMatched" have a matching hashcode.

TaskHashSearch::findHashInFile ( fileName,
hashCode 
) [protected]

Searches the given hashcode in a file.

Returns:
Array of String
Return values:
linesMatchArray of the matching lines (if any were found).
NULLIf contents of hash-containing file ($fileName) were empty.
FALSEIf no lines matching the hashcode were found.

Prepare everything so it's ready for processing.

Returns:
bool success True if init went fine, False if an error occurred.

Reimplemented from CITask.

Load settings from config that are relevant for this task.

Reimplemented from TaskHash.

Perform the actual steps of this task.

Reimplemented from CITask.

TaskHashSearch::searchHashCode ( sourceFolder,
hashCode 
) [protected]

Tries to find the given hashcode in the source folder matching the glob patterns in "$this->hashSearch glob". Returns an array with key is filename where match was found - and value is an array of lines containing the hashcode. Returns false if no match is found.

TaskHashSearch::searchHashCodes ( sourceFolder) [protected]

Iterates through all files in source folder and searches for existing checksums.


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