1
1
Fork 0

Ensure that the spool path is set

This commit is contained in:
Michael 2017-02-19 10:13:40 +00:00
parent 2bfc40d74c
commit 9251d2af6f
2 changed files with 7 additions and 4 deletions

View file

@ -860,9 +860,12 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
// We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates // We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates
$file = 'item-'.round(microtime(true) * 10000).'-'.mt_rand().'.msg'; $file = 'item-'.round(microtime(true) * 10000).'-'.mt_rand().'.msg';
$spool = get_spoolpath().'/'.$file; $spoolpath = get_spoolpath();
if ($spoolpath != "") {
$spool = $spoolpath.'/'.$file;
file_put_contents($spool, json_encode($arr)); file_put_contents($spool, json_encode($arr));
logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG); logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG);
}
return 0; return 0;
} }

View file

@ -27,7 +27,7 @@ function spool_post_run($argv, $argc) {
$path = get_spoolpath(); $path = get_spoolpath();
if (is_writable($path)){ if (($path != '') AND is_writable($path)){
if ($dh = opendir($path)) { if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {