Skip to content
Snippets Groups Projects
Commit b7d3939c authored by Demian Katz's avatar Demian Katz
Browse files

Maintain separate cache in CLI mode to avoid permission problems.

Resolves VUFIND-839.
parent 2136b734
No related merge requests found
...@@ -151,12 +151,18 @@ class Manager ...@@ -151,12 +151,18 @@ class Manager
if (substr($dir, -1) != '/') { if (substr($dir, -1) != '/') {
$dir .= '/'; $dir .= '/';
} }
return $dir; } else if (strlen(LOCAL_OVERRIDE_DIR) > 0) {
$dir = LOCAL_OVERRIDE_DIR . '/cache/';
} else {
$dir = APPLICATION_PATH . '/data/cache/';
} }
if (strlen(LOCAL_OVERRIDE_DIR) > 0) {
return LOCAL_OVERRIDE_DIR . '/cache/'; // Use separate cache dir in CLI mode to avoid permission issues:
if (PHP_SAPI == 'cli') {
$dir .= 'cli/';
} }
return APPLICATION_PATH . '/data/cache/';
return $dir;
} }
/** /**
...@@ -211,6 +217,11 @@ class Manager ...@@ -211,6 +217,11 @@ class Manager
// 0777 is chmod default, use if dir_permission is not explicitly set // 0777 is chmod default, use if dir_permission is not explicitly set
$dir_perm = 0777; $dir_perm = 0777;
} }
// Make sure cache parent directory and directory itself exist:
$parentDir = dirname($dirName);
if (!is_dir($parentDir) && !@mkdir($parentDir, $dir_perm)) {
$this->directoryCreationError = true;
}
if (!@mkdir($dirName, $dir_perm)) { if (!@mkdir($dirName, $dir_perm)) {
$this->directoryCreationError = true; $this->directoryCreationError = true;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment