From e1ea2db29faad94f6df7f8c0d9c59873d7c8015e Mon Sep 17 00:00:00 2001 From: SyBernot Date: Wed, 31 Jul 2013 08:46:39 -0700 Subject: [PATCH] Update build_bind.inc.php modify queries to return only domains that need rebuilt for each server and add query to unset the rebuild_flag once it has been built --- build_bind.inc.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/build_bind.inc.php b/build_bind.inc.php index 192ad85..f0a3e7b 100644 --- a/build_bind.inc.php +++ b/build_bind.inc.php @@ -91,14 +91,21 @@ function build_bind_server_domain_list($options="") { return(array(3, $self['error'] . "\n")); } - // For the given server id. find all domains for that server - list($status, $rows, $records) = db_get_records($onadb, 'dns_server_domains', array('host_id' => $shost['id']), ''); + // For the given server id. find all domains for that server that need rebuilt + list($status, $rows, $records) = db_get_records($onadb, 'dns_server_domains', array('host_id' => $shost['id'], 'rebuild_flag' => 1), ''); - //MP: TODO - for now this just returns a list of all the domains. In the future this could/should just return - // a list of domains that need refreshed. This would imply a version to do ALL and one for just UPDATED domains. + //This just returns a list of domains that need refreshed. foreach ($records as $sdomain) { list($status, $rows, $domain) = ona_get_domain_record(array('id' => $sdomain['domain_id'])); $text .= $domain['fqdn'] . "\n"; + // TRIGGER: flag the current domain/server as built + list($status, $rows) = db_update_record($onadb, 'dns_server_domains', array('domain_id' => $sdomain['domain_id'], 'host_id' => $shost['id']), array('rebuild_flag' => 0)); + if ($status) { + $self['error'] = "ERROR => db_update_record() Unable to update rebuild flags for domain.: {$self['error']}"; + printmsg($self['error'],0); + return(array(7, $self['error'] . "\n")); + } + } // Return the list @@ -107,12 +114,6 @@ function build_bind_server_domain_list($options="") { - - - - - - /////////////////////////////////////////////////////////////////////// // Function: build_bind_conf (string $options='') //