Added "mode" for file - tag in ConfigDaemon
Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
@@ -233,20 +233,19 @@ class ConfigDaemon {
|
|||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
private function _parseFile($order, $attributes) {
|
private function _parseFile($order, $attributes) {
|
||||||
|
$visibility = 1;
|
||||||
// No sub - elements, so the content can be returned directly
|
// No sub - elements, so the content can be returned directly
|
||||||
if ($order->count() == 0) {
|
if ($order->count() == 0) {
|
||||||
return array('type' => 'file', 'content' => (string)$order, 'name' => $this->_parseContent($attributes['name']));
|
$content = (string)$order;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// Hold the results
|
// Hold the results
|
||||||
$visibility = 1;
|
|
||||||
$content = '';
|
|
||||||
foreach($order->children() as $child) {
|
foreach($order->children() as $child) {
|
||||||
switch((string)$child->getName()) {
|
switch((string)$child->getName()) {
|
||||||
case "visibility": $visibility += $this->_checkVisibility($child); break;
|
case "visibility": $visibility += $this->_checkVisibility($child); break;
|
||||||
case "content": $content = (string)$child; break;
|
case "content": $content = (string)$child; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
// Check if the original file should be backupped
|
// Check if the original file should be backupped
|
||||||
@@ -257,7 +256,11 @@ class ConfigDaemon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now the content of the file can be written
|
// 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']));
|
$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
|
// Let's check if the mode of the file should be changed
|
||||||
if (array_key_exists('chmod', $attributes)) {
|
if (array_key_exists('chmod', $attributes)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user