summaryrefslogtreecommitdiff
path: root/webgli
diff options
context:
space:
mode:
authorAndrew Gaffney <agaffney@gentoo.org>2006-04-16 02:10:01 +0000
committerAndrew Gaffney <agaffney@gentoo.org>2006-04-16 02:10:01 +0000
commit97c26294ee073e361b80adb6a0be42079898ae5c (patch)
treead9880f0a00bb8cab58add65861ab7e36db62d79 /webgli
parentdon't write out xml unless saving values (diff)
downloadscire-97c26294ee073e361b80adb6a0be42079898ae5c.tar.gz
scire-97c26294ee073e361b80adb6a0be42079898ae5c.tar.bz2
scire-97c26294ee073e361b80adb6a0be42079898ae5c.zip
don't serialize etc-files if it's empty
svn path=/; revision=26
Diffstat (limited to 'webgli')
-rw-r--r--webgli/webgliIP.php29
1 files changed, 16 insertions, 13 deletions
diff --git a/webgli/webgliIP.php b/webgli/webgliIP.php
index 65d6b0a..563e33d 100644
--- a/webgli/webgliIP.php
+++ b/webgli/webgliIP.php
@@ -180,22 +180,25 @@ class InstallProfile extends XMLParser {
}
function serialize_etc_files() {
- $this->xmldoc .= "\t<etc-files>\n";
- foreach($this->get("etc_files") as $etc_file => $values) {
- $this->xmldoc .= sprintf("\t\t<file name=\"%s\">\n", $etc_file);
- $isalist = (array_keys($values) === range(0, count($values) - 1)) ? true : false;
- foreach($values as $name => $value) {
- $this->xmldoc .= "\t\t\t<entry";
- if($isalist) {
- $this->xmldoc .= sprintf(">%s", $value);
- } else {
- $this->xmldoc .= sprintf(" name=\"%s\">%s", $name, $value);
+ $etc_files = $this->get("etc_files");
+ if($etc_files) {
+ $this->xmldoc .= "\t<etc-files>\n";
+ foreach($etc_files as $etc_file => $values) {
+ $this->xmldoc .= sprintf("\t\t<file name=\"%s\">\n", $etc_file);
+ $isalist = (array_keys($values) === range(0, count($values) - 1)) ? true : false;
+ foreach($values as $name => $value) {
+ $this->xmldoc .= "\t\t\t<entry";
+ if($isalist) {
+ $this->xmldoc .= sprintf(">%s", $value);
+ } else {
+ $this->xmldoc .= sprintf(" name=\"%s\">%s", $name, $value);
+ }
+ $this->xmldoc .= "</entry>\n";
}
- $this->xmldoc .= "</entry>\n";
+ $this->xmldoc .= "\t\t</file>\n";
}
- $this->xmldoc .= "\t\t</file>\n";
+ $this->xmldoc .= "\t</etc-files>\n";
}
- $this->xmldoc .= "\t</etc-files>\n";
}
function parse_network_interface($device, $attr) {