From 83733160e5103a6d4ac3186d32c732d3eb788b36 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Fri, 7 Mar 2014 12:48:16 +0000 Subject: [PATCH] Bugfix do_actions, happy monkey was here ! --- install/upgrades/3.1.0~a.sql | 2 +- install/upgrades/3.3.0~a.sql | 1 + src/do_actions.php | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/install/upgrades/3.1.0~a.sql b/install/upgrades/3.1.0~a.sql index 79d9b847..c717b8aa 100644 --- a/install/upgrades/3.1.0~a.sql +++ b/install/upgrades/3.1.0~a.sql @@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `vm_history` ( CREATE TABLE IF NOT EXISTS `actions` ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, - type enum ('CREATE_FILE','CREATE_DIR','DELETE','MOVE','FIXDIR','FIXFILE', 'FIXUSER'), + type enum ('CREATE_FILE','FIX_USER','CREATE_DIR','DELETE','MOVE','FIX_DIR','FIX_FILE'), parameters longtext default NULL, creation timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, begin timestamp, diff --git a/install/upgrades/3.3.0~a.sql b/install/upgrades/3.3.0~a.sql index e389487d..5bed9c5d 100644 --- a/install/upgrades/3.3.0~a.sql +++ b/install/upgrades/3.3.0~a.sql @@ -6,4 +6,5 @@ ALTER TABLE variable ADD strata_id bigint DEFAULT NULL; ALTER TABLE variable ADD type text DEFAULT ''; ALTER TABLE variable ADD UNIQUE (name, strata, strata_id); +ALTER TABLE actions MODIFY COLUMN type enum('CREATE_FILE','FIX_USER','CREATE_DIR','DELETE','MOVE','FIX_DIR','FIX_FILE'); diff --git a/src/do_actions.php b/src/do_actions.php index 9ad112a5..885ad958 100644 --- a/src/do_actions.php +++ b/src/do_actions.php @@ -93,7 +93,7 @@ if (file_exists($LOCK_FILE) !== false){ $params=unserialize($c["parameters"]); // We can resume these types of action, so we reset the job to process it later d("Previous job was the n°".$c["id"]." : '".$c["type"]."'"); - if($c["type"] == "CREATE_FILE" && is_dir(dirname($params["file"])) || $c["type"] == "CREATE_DIR" || $c["type"] == "DELETE" || $c["type"] == "FIXDIR" || $c["type"] == "FIXFILE"){ + if($c["type"] == "CREATE_FILE" && is_dir(dirname($params["file"])) || $c["type"] == "CREATE_DIR" || $c["type"] == "DELETE" || $c["type"] == "FIX_DIR" || $c["type"] == "FIX_FILE"){ d("Reset of the job! So it will be resumed..."); $action->reset_job($c["id"]); }else{ @@ -158,12 +158,12 @@ while ($rr=$action->get_action()){ if(!isset($output[0])) @exec("$SU mv -f ".$params["src"]." ".$params["dst"]." 2>&1", $output); break; - case "FIXDIR" : + case "FIX_DIR" : @exec("$FIXPERM -d ".$params["dir"]." 2>&1", $trash, $code); if($code!=0) $output[0]="Fixperms.sh failed, returned error code : $code"; break; - case "FIXFILE" : + case "FIX_FILE" : @exec("$FIXPERM -f ".$params["file"]." 2>&1", $trash, $code); if($code!=0) $output[0]="Fixperms.sh failed, returned error code : $code";