diff --git a/.gitattributes b/.gitattributes index b6f1d6c5..0d16ff67 100644 --- a/.gitattributes +++ b/.gitattributes @@ -594,6 +594,7 @@ src/courier-dovecot-migrate.pl -text src/cron_users.sh -text src/cron_users_doit.sh -text src/delete_logs.sh -text +src/do_actions.php -text src/du.pl -text src/export_account.php -text src/fixperms.sh -text diff --git a/src/do_actions.php b/src/do_actions.php new file mode 100644 index 00000000..c6ff9da4 --- /dev/null +++ b/src/do_actions.php @@ -0,0 +1,94 @@ +#!/usr/bin/php -q +get_action()){ + // We lock the action + $action->begin($r[id]); + // We process it + $params=array($r["parameters"]); + // We exec with the specified user + exec("su ".$params["user"]); + switch ($r["type"]){ + case "CREATE_FILE" : + $return=file_put_contents($params["file"],$params["contents"]); + break; + case "CREATE_DIR" : + $return=mkdir($params["dir"])); + break; + case "DELETE" : + $return=exec("rm -rf ".$params["dir"]); + break; + case "MOVE" : + $return=rename($params["src"],$params["dst"]); + break; + default : + break; + } + // We finished the action, notify the DB + $action->finish($r["id"],$return); +} + +// Unlock the script +unlink($LOCK_FILE); +?>