Added "mode" for file - tag in ConfigDaemon

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas)
2015-02-04 10:19:57 +01:00
parent 859665fbd0
commit 96e7a3ad8c

View File

@@ -233,20 +233,19 @@ class ConfigDaemon {
* @return array|string
*/
private function _parseFile($order, $attributes) {
$visibility = 1;
// No sub - elements, so the content can be returned directly
if ($order->count() == 0) {
return array('type' => 'file', 'content' => (string)$order, 'name' => $this->_parseContent($attributes['name']));
}
$content = (string)$order;
} else {
// Hold the results
$visibility = 1;
$content = '';
foreach($order->children() as $child) {
switch((string)$child->getName()) {
case "visibility": $visibility += $this->_checkVisibility($child); break;
case "content": $content = (string)$child; break;
}
}
}
$return = array();
// Check if the original file should be backupped
@@ -257,7 +256,11 @@ class ConfigDaemon {
}
// Now the content of the file can be written
if (isset($attributes['mode'])) {
$return[] = array('type' => 'file', 'content' => $this->_parseContent($content), 'name' => $this->_parseContent($attributes['name']), 'mode' => $this->_parseContent($attributes['mode']));
} else {
$return[] = array('type' => 'file', 'content' => $this->_parseContent($content), 'name' => $this->_parseContent($attributes['name']));
}
// Let's check if the mode of the file should be changed
if (array_key_exists('chmod', $attributes)) {