From 7e4f59f3222cd373a877f0f9d585fe2964668536 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Mon, 26 Sep 2011 17:50:57 +1000 Subject: [PATCH] Added extra vault error checking --- vendors/shells/vault.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vendors/shells/vault.php b/vendors/shells/vault.php index 2213f9c3..4f092de6 100755 --- a/vendors/shells/vault.php +++ b/vendors/shells/vault.php @@ -41,7 +41,7 @@ class VaultShell extends Shell { $processed_dir = '/var/www/cakephp/app/processed_vaultmsgs'; $lockfile = '/var/www/cakephp/app/vault.lock'; } - + if(file_exists($lockfile)) { die("Error: Another process is currently running. Terminating this one"); } @@ -50,7 +50,7 @@ class VaultShell extends Shell { die("FATAL ERROR: Unable to create vault.lock"); } } - + /* Find the strings we want to look for in the subjects. Build arrays * using the string as the keys, IDs as the value @@ -116,7 +116,12 @@ class VaultShell extends Shell { if(!$content) { echo "No Content Found. Ignoring this email\n"; if(!$this->makeSymlink($email_filename, $vault_dir, $processed_dir)) { - die("Unable to make symlink to process this email Critical error: {$email_filename}"); + echo "Unable to make symlink to process this email Critical error: {$email_filename}\n"; + + if(!unlink($lockfile)) { + die("FATAL ERROR: Unable to remove vault.lock. No further Vault instances can run!"); + } + } else { continue;