Commit cace612b authored by anarcat's avatar anarcat Committed by anarcat

proper SOA parsing, it's still written wrong though

parent d4503b34
......@@ -121,17 +121,23 @@ class provisionConfig_bind_zone extends provisionConfig {
$body = file_get_contents($this->filename());
$data = array();
if (preg_match('/^@?\s*IN\s*SOA\s*(\([^\)]*\))\s*$/', $body, $matches)) {
drush_log("found SOA: " . $matches[1]);
$data['SOA'] = $matches[1];
$SOA = preg_split('\s*', $matches[1]);
$i = 0;
foreach (array('serial', 'refresh', 'retry', 'expire', 'negativettl') as $param) {
$data[$param] = $SOA[$i++];
}
} else {
drush_log("no SOA found, setting sane defaults");
$data['serial'] = provisionService_dns::increment_serial();
drush_log("serial: " . $data['serial']);
foreach (array('ttl', 'refresh', 'retry', 'expire', 'negativettl') as $param) {
drush_log($param . ": " . $this->$param);
$data[$param] = $this->$param;
$longparam = "dns_" . $param;
$data[$param] = $this->$longparam;
}
}
drush_log("parsed SOA from zonefile:");
foreach ($data as $key => $value) {
drush_log($key . ": " . $value);
}
return $data;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment