예제 #1
0
// Register module specific tasks
$taskedModules = ModuleUtility::registerModuleTasks();
print_r($taskedModules);
// Execute the next appropriate (if available) queue and return a status code
$retVal = QueueProcessor::startNextTask();
// Mark the queue processor last-run time
touch(QUEUE_STATUS_FILE);
if (file_exists(QUEUE_CLEANUP_FILE)) {
    $lastCleanupTime = @filemtime(QUEUE_CLEANUP_FILE);
} else {
    $lastCleanupTime = 0;
}
if (time() - $lastCleanupTime > QUEUE_CLEANUP_HOURS * 60 * 60 || !$lastCleanupTime) {
    @touch(QUEUE_CLEANUP_FILE);
    QueueProcessor::cleanUpErroredTasks();
    QueueProcessor::cleanUpOldQueues();
}
echo "CATS Queue Processor status: ";
switch ($retVal) {
    case TASKRET_ERROR:
        echo "ERROR";
        break;
    case TASKRET_FAILURE:
        echo "FAILURE";
        break;
    case TASKRET_NO_TASKS:
        echo "NO TASKS";
        break;
    case TASKRET_SUCCESS:
        echo "SUCCESS";
        break;