Group file-commands for easier processing in ConfigDaemon
Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
@@ -280,10 +280,10 @@ class ConfigDaemon {
|
|||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
// Check if the original file should be backupped
|
// Check if the original file should be backupped
|
||||||
// @TODO: Maybe have a backup - space somewhere?
|
// @TODO: Maybe have a backup - location somewhere central?
|
||||||
// @TODO: Use IO - class
|
// @TODO: Use IO - class
|
||||||
if (array_key_exists('backup', $attributes)) {
|
if (array_key_exists('backup', $attributes)) {
|
||||||
$return[] = array('type' => 'command', 'content' => 'mv "' . $this->_parseContent($attributes['name']) . '" "' . $this->_parseContent($attributes['name']) . '.frx.bak"', 'file' => $this->_parseContent($attributes['name']));
|
$return[] = array('type' => 'command', 'content' => 'mv "' . $this->_parseContent($attributes['name']) . '" "' . $this->_parseContent($attributes['name']) . '.frx.bak"');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now the content of the file can be written
|
// Now the content of the file can be written
|
||||||
@@ -295,12 +295,17 @@ class ConfigDaemon {
|
|||||||
|
|
||||||
// Let's check if the mode of the file should be changed
|
// Let's check if the mode of the file should be changed
|
||||||
if (array_key_exists('chmod', $attributes)) {
|
if (array_key_exists('chmod', $attributes)) {
|
||||||
$return[] = array('type' => 'command', 'content' => 'chmod ' . $attributes['chmod'] . ' "' . $this->_parseContent($attributes['name']) . '"', 'file' => $this->_parseContent($attributes['name']));
|
$return[] = array('type' => 'command', 'content' => 'chmod ' . $attributes['chmod'] . ' "' . $this->_parseContent($attributes['name']) . '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's check if the owner of the file should be changed
|
// Let's check if the owner of the file should be changed
|
||||||
if (array_key_exists('chown', $attributes)) {
|
if (array_key_exists('chown', $attributes)) {
|
||||||
$return[] = array('type' => 'command', 'content' => 'chown ' . $attributes['chown'] . ' "' . $this->_parseContent($attributes['name']) . '"', 'file' => $this->_parseContent($attributes['name']));
|
$return[] = array('type' => 'command', 'content' => 'chown ' . $attributes['chown'] . ' "' . $this->_parseContent($attributes['name']) . '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have more than 1 element, we want to group this stuff for easier processing later
|
||||||
|
if (count($return) > 1) {
|
||||||
|
$return = array('type' => 'file', 'subcommands' => $return, 'name' => $this->_parseContent($attributes['name']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($visibility > 0) {
|
if ($visibility > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user