Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
FileLoader Class Reference
Inheritance diagram for FileLoader:
ScheduledTask UsageStatsLoader

Public Member Functions

 _archiveFile ()
 
 _claimNextFile ()
 
 _moveFile ($sourceDir, $destDir, $filename)
 
 _rejectFile ()
 
 _stageFile ()
 
 checkFolderStructure ($install=false)
 
 execute ()
 
 FileLoader ($args)
 
 getArchivePath ()
 
 getName ()
 
 getProcessingPath ()
 
 getRejectPath ()
 
 getStagePath ()
 
 processFile ($filePath, &$errorMsg)
 
- Public Member Functions inherited from ScheduledTask
 _getAllMessageTypes ()
 
 _newProcessId ()
 
 execute ()
 
 getName ()
 
 getProcessId ()
 
 notify ($type, $message, $subject= '')
 
 ScheduledTask ($args=array())
 

Detailed Description

Base scheduled task class to reliably handle files processing.

Definition at line 24 of file FileLoader.inc.php.

Member Function Documentation

FileLoader::_archiveFile ( )

Archive the current claimed file.

Definition at line 273 of file FileLoader.inc.php.

References _moveFile().

Referenced by execute().

FileLoader::_claimNextFile ( )

Claim the first file that's inside the staging folder.

Returns
mixed The claimed file path or false if the claim was not successful.

Definition at line 243 of file FileLoader.inc.php.

References _moveFile().

Referenced by execute().

FileLoader::_moveFile (   $sourceDir,
  $destDir,
  $filename 
)

Move file between filesystem directories.

Parameters
$sourceDirstring
$destDirstring
$filenamestring
Returns
string The destination path of the moved file.

Definition at line 291 of file FileLoader.inc.php.

References ScheduledTask\notify().

Referenced by _archiveFile(), _claimNextFile(), _rejectFile(), and _stageFile().

FileLoader::_rejectFile ( )

Reject the current claimed file.

Definition at line 266 of file FileLoader.inc.php.

References _moveFile().

Referenced by execute().

FileLoader::_stageFile ( )

Stage the current claimed file.

Definition at line 280 of file FileLoader.inc.php.

References _moveFile().

Referenced by execute().

FileLoader::checkFolderStructure (   $install = false)

A public helper function that can be used to ensure that the file structure has actually been installed.

Parameters
$installboolean Set this parameter to true to install the folder structure if it is missing.
Returns
boolean True if the folder structure exists, otherwise false.

Definition at line 165 of file FileLoader.inc.php.

References Config\getVar(), and ScheduledTask\notify().

Referenced by execute(), and UsageStatsLoader\UsageStatsLoader().

FileLoader::execute ( )

Execute the specified command.

Returns
boolean True if no errors, otherwise false.

Definition at line 127 of file FileLoader.inc.php.

References _archiveFile(), _claimNextFile(), _rejectFile(), _stageFile(), checkFolderStructure(), ScheduledTask\notify(), and processFile().

FileLoader::FileLoader (   $args)

Constructor.

Parameters
$argsarray script arguments

Definition at line 51 of file FileLoader.inc.php.

References DAORegistry\getDAO().

FileLoader::getArchivePath ( )

Return the archive path.

Returns
string

Definition at line 114 of file FileLoader.inc.php.

FileLoader::getName ( )
See Also
ScheduledTask::getName()

Definition at line 230 of file FileLoader.inc.php.

FileLoader::getProcessingPath ( )

Return the processing path.

Returns
string

Definition at line 98 of file FileLoader.inc.php.

Referenced by UsageStatsLoader\UsageStatsLoader().

FileLoader::getRejectPath ( )

Return the reject path.

Returns
string

Definition at line 106 of file FileLoader.inc.php.

FileLoader::getStagePath ( )

Return the staging path.

Returns
string

Definition at line 90 of file FileLoader.inc.php.

FileLoader::processFile (   $filePath,
$errorMsg 
)

Abstract method that must be implemented by subclasses to process the passed file.

Parameters
$filePathstring
$errorMsgstring Define a custom error message to be used to notify the administrator about the error. This message will be used if the return value is false.
Returns
mixed
See Also
FileLoader::execute to understand the expected return values.

Definition at line 223 of file FileLoader.inc.php.

Referenced by execute().


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