Skip to content

Commit

Permalink
pkp#9979 use class name for scheduled task log file name
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Jun 16, 2024
1 parent e543199 commit d4cbeaf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions classes/scheduledTask/ScheduledTask.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ function __construct($args = array()) {

// Ensure common locale keys are available
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN, LOCALE_COMPONENT_APP_ADMIN, LOCALE_COMPONENT_PKP_COMMON);

// Check the scheduled task execution log folder.
import('lib.pkp.classes.file.PrivateFileManager');
$fileMgr = new PrivateFileManager();

$scheduledTaskFilesPath = realpath($fileMgr->getBasePath()) . DIRECTORY_SEPARATOR . SCHEDULED_TASK_EXECUTION_LOG_DIR;
$this->_executionLogFile = $scheduledTaskFilesPath . DIRECTORY_SEPARATOR . str_replace(' ', '', $this->getName()) .
$classNameParts = explode('\\', get_class($this)); // Separate namespace info from class name
$this->_executionLogFile = $scheduledTaskFilesPath . DIRECTORY_SEPARATOR . end($classNameParts) .
'-' . $this->getProcessId() . '-' . date('Ymd') . '.log';
if (!$fileMgr->fileExists($scheduledTaskFilesPath, 'dir')) {
$success = $fileMgr->mkdirtree($scheduledTaskFilesPath);
Expand Down Expand Up @@ -115,7 +116,7 @@ function addExecutionLogEntry($message, $type = null) {
} else {
fatalError("Couldn't lock the file.");
}
fclose($fp);
fclose($fp);
}


Expand Down

0 comments on commit d4cbeaf

Please sign in to comment.