Bugfix do_actions, happy monkey was here !

This commit is contained in:
Alan Garcia 2014-03-07 12:48:16 +00:00
parent 13bbebaca1
commit 83733160e5
3 changed files with 5 additions and 4 deletions

View File

@ -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,

View File

@ -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');

View File

@ -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";