fix: [backgroundJobs] Added default fallback for settings & Use proper filepath when Redis not enabled

pull/8288/merge
Sami Mokaddem 2022-11-06 18:25:48 +01:00
parent 6b638085ae
commit d03dc9c73b
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 6 additions and 2 deletions

View File

@ -89,7 +89,11 @@ abstract class AppShell extends Shell
protected function getBackgroundJobsTool()
{
if (!isset($this->BackgroundJobsTool)) {
$this->BackgroundJobsTool = new BackgroundJobsTool(Configure::read('SimpleBackgroundJobs'));
$settings = ['enabled' => false];
if (!empty(Configure::read('SimpleBackgroundJobs.enabled'))) {
$settings = Configure::read('SimpleBackgroundJobs');
}
$this->BackgroundJobsTool = new BackgroundJobsTool($settings);
}
return $this->BackgroundJobsTool;
}

View File

@ -161,7 +161,7 @@ class BackgroundJobsTool
}
RedisTool::unlink($this->RedisConnection, self::DATA_CONTENT_PREFIX . ':' . $uuid);
return $data;
} else if ($path[0] === '/') { // deprecated storage location when not full path is provided
} else if ($path[0] !== '/') { // deprecated storage location when not full path is provided
$path = APP . 'tmp/cache/ingest' . DS . $path;
}
return JsonTool::decode(FileAccessTool::readAndDelete($path));