Open Monograph Press  3.3.0
UsageStatsLoader Class Reference
Inheritance diagram for UsageStatsLoader:
FileLoader ScheduledTask

Public Member Functions

 __construct ($args)
 
 getName ()
 
 getOJSFileTypeFromAssoc ($assocType, $assocId)
 
- Public Member Functions inherited from FileLoader
 checkFolderStructure ($install=false)
 
 getArchivePath ()
 
 getCompressArchives ()
 
 getProcessingPath ()
 
 getRejectPath ()
 
 getStagePath ()
 
 setCompressArchives ($compressArchives)
 
- Public Member Functions inherited from ScheduledTask
 addExecutionLogEntry ($message, $type=null)
 
 execute ()
 
 getHelper ()
 
 getProcessId ()
 

Data Fields

 $_autoStage
 
 $_contextsByPath
 
 $_externalLogFiles
 
 $_geoLocationTool
 
 $_plugin
 

Protected Member Functions

 autoStage ()
 
 executeActions ()
 
 getAssoc ($assocType, $contextPaths, $page, $op, $args)
 
 getContextByPath ($contextPaths)
 
 getExpectedPageAndOp ()
 
 getFileTypeFromAssoc ($assocType, $assocId)
 
 getFileTypeFromFile ($file)
 
 getMetricType ()
 
 getOJSAssoc ($assocType, $contextPaths, $page, $op, $args)
 
 getOMPAssoc ($assocType, $contextPaths, $page, $op, $args)
 
 getOPSAssoc ($assocType, $contextPaths, $page, $op, $args)
 
 processFile ($filePath)
 
- Protected Member Functions inherited from FileLoader
 moveFile ($sourceDir, $destDir, $filename)
 

Detailed Description

Scheduled task to extract transform and load usage statistics data into database.

Definition at line 23 of file UsageStatsLoader.inc.php.

Constructor & Destructor Documentation

◆ __construct()

UsageStatsLoader::__construct (   $args)

Member Function Documentation

◆ autoStage()

UsageStatsLoader::autoStage ( )
protected

Auto stage usage stats log files, also moving files that might be in processing folder to stage folder.

Definition at line 288 of file UsageStatsLoader.inc.php.

References $_plugin, FileLoader\getProcessingPath(), FileLoader\getStagePath(), and FileLoader\moveFile().

Referenced by executeActions().

◆ executeActions()

UsageStatsLoader::executeActions ( )
protected

Implement this method to execute the task actions.

Returns
boolean true iff success

Reimplemented from FileLoader.

Definition at line 123 of file UsageStatsLoader.inc.php.

References $_plugin, ScheduledTask\addExecutionLogEntry(), autoStage(), and FileLoader\getProcessingPath().

◆ getAssoc()

UsageStatsLoader::getAssoc (   $assocType,
  $contextPaths,
  $page,
  $op,
  $args 
)
protected

Get assoc type and id from the passed page, operation and arguments.

Parameters
$assocTypeASSOC_TYPE_...
$contextPathsarray
$pagestring
$opstring
$argsarray
Returns
array (assocId, assocType)

Definition at line 426 of file UsageStatsLoader.inc.php.

References $application, $op, PKPApplication\get(), Application\getContextAssocType(), getContextByPath(), DAORegistry\getDAO(), getOJSAssoc(), getOMPAssoc(), and getOPSAssoc().

Referenced by processFile().

◆ getContextByPath()

UsageStatsLoader::getContextByPath (   $contextPaths)
protected

Get the context object based on the context path array that's returned by Core::getContextPaths()

Parameters
$contextPathsarray
Returns
mixed null|Context
See also
Core::getContextPaths()

Definition at line 640 of file UsageStatsLoader.inc.php.

References $application, and PKPApplication\get().

Referenced by getAssoc().

◆ getExpectedPageAndOp()

UsageStatsLoader::getExpectedPageAndOp ( )
protected

Get the expected page and operation from the stats plugin. They are grouped by the object type constant that they give access to.

Returns
array

Definition at line 659 of file UsageStatsLoader.inc.php.

References $application, PKPApplication\get(), and Application\getContextAssocType().

◆ getFileTypeFromAssoc()

UsageStatsLoader::getFileTypeFromAssoc (   $assocType,
  $assocId 
)
protected

Based on the passed object data, get the file type.

Parameters
$assocTypeint
$assocIdint
Returns
mixed int|null Return one of the file types constants STATISTICS_FILE_TYPE... if the object is a file, if not, return null.

Definition at line 327 of file UsageStatsLoader.inc.php.

References $application, PKPApplication\get(), DAORegistry\getDAO(), getFileTypeFromFile(), and getOJSFileTypeFromAssoc().

Referenced by processFile().

◆ getFileTypeFromFile()

UsageStatsLoader::getFileTypeFromFile (   $file)
protected

Associate the passed file type with one of the file type statistics constants.

Parameters
$filePKPFile
Returns
int One of the file type constants STATISTICS_FILE_TYPE...

Definition at line 376 of file UsageStatsLoader.inc.php.

Referenced by getFileTypeFromAssoc(), and getOJSFileTypeFromAssoc().

◆ getMetricType()

UsageStatsLoader::getMetricType ( )
protected

Get metric type on which this loader process statistics.

Definition at line 262 of file UsageStatsLoader.inc.php.

References $application, and PKPApplication\get().

◆ getName()

UsageStatsLoader::getName ( )

Get the scheduled task name. Override to define a custom task name.

Returns
string

Reimplemented from ScheduledTask.

Definition at line 116 of file UsageStatsLoader.inc.php.

◆ getOJSAssoc()

UsageStatsLoader::getOJSAssoc (   $assocType,
  $contextPaths,
  $page,
  $op,
  $args 
)
protected

Get assoc type and id from the passed page, operation and arguments specific to OJS.

Parameters
$assocTypeASSOC_TYPE_...
$contextPathsarray
$pagestring
$opstring
$argsarray
Returns
array (assocId, assocType)

Definition at line 479 of file UsageStatsLoader.inc.php.

References DAORegistry\getDAO().

Referenced by getAssoc().

◆ getOJSFileTypeFromAssoc()

UsageStatsLoader::getOJSFileTypeFromAssoc (   $assocType,
  $assocId 
)

Based on the passed object data, get the OJS specific file type.

Parameters
$assocTypeint
$assocIdint
Returns
mixed int|null Return one of the file types constants STATISTICS_FILE_TYPE... if the object is a file, if not, return null.

Definition at line 358 of file UsageStatsLoader.inc.php.

References DAORegistry\getDAO(), and getFileTypeFromFile().

Referenced by getFileTypeFromAssoc().

◆ getOMPAssoc()

UsageStatsLoader::getOMPAssoc (   $assocType,
  $contextPaths,
  $page,
  $op,
  $args 
)
protected
Parameters
$assocTypeASSOC_TYPE_...
$contextPathsarray
$pagestring
$opstring
$argsarray
Returns
array (assocId, assocType)

Definition at line 549 of file UsageStatsLoader.inc.php.

References DAORegistry\getDAO(), and Application\getSectionDAO().

Referenced by getAssoc().

◆ getOPSAssoc()

UsageStatsLoader::getOPSAssoc (   $assocType,
  $contextPaths,
  $page,
  $op,
  $args 
)
protected

Get assoc type and id from the passed page, operation and arguments specific to OPS.

Parameters
$assocTypeASSOC_TYPE_...
$contextPathsarray
$pagestring
$opstring
$argsarray
Returns
array (assocId, assocType)

Definition at line 602 of file UsageStatsLoader.inc.php.

References DAORegistry\getDAO().

Referenced by getAssoc().

◆ processFile()

UsageStatsLoader::processFile (   $filePath)
protected

Process the passed file.

Parameters
$filePathstring
Returns
mixed
See also
FileLoader::execute to understand the expected return values. The File must be a Log File parsable by the regex in _getDataFromLogEntry() and the File's entries must be ordered by date-time to successfully identify double-clicks

Reimplemented from FileLoader.

Definition at line 150 of file UsageStatsLoader.inc.php.

References $_geoLocationTool, $_plugin, $op, ScheduledTask\addExecutionLogEntry(), getAssoc(), DAORegistry\getDAO(), getFileTypeFromAssoc(), and Core\isUserAgentBot().

Field Documentation

◆ $_autoStage

$_autoStage UsageStatsLoader::$_autoStage

string

Definition at line 47 of file UsageStatsLoader.inc.php.

◆ $_contextsByPath

$_contextsByPath UsageStatsLoader::$_contextsByPath

array

Definition at line 41 of file UsageStatsLoader.inc.php.

◆ $_externalLogFiles

$_externalLogFiles UsageStatsLoader::$_externalLogFiles

string

Definition at line 53 of file UsageStatsLoader.inc.php.

◆ $_geoLocationTool

A UsageStatsLoader::$_geoLocationTool

GeoLocationTool object instance to provide geo location based on ip.

Definition at line 29 of file UsageStatsLoader.inc.php.

Referenced by processFile().

◆ $_plugin

$_plugin UsageStatsLoader::$_plugin

Plugin

Definition at line 35 of file UsageStatsLoader.inc.php.

Referenced by autoStage(), executeActions(), and processFile().


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