Changeset 524


Ignore:
Timestamp:
06/12/13 17:48:53 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Add force_refresh option in configuration to allow forcing the
cached zone data to be refreshed on every export.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r523 r524  
    208208                perpage         => 15,
    209209                max_fcgi_requests => 100,       # reasonable default?
     210                force_refresh   => 1,
    210211        );
    211212
     
    235236        };
    236237  bless $self, $class;
     238
     239  # Several settings are booleans.  Handle multiple possible ways of setting them.
     240  for my $boolopt ('log_failures', 'force_refresh') {
     241    if ($self->{$boolopt} ne '1' && $self->{$boolopt} ne '0') {
     242      # true/false, on/off, yes/no all valid.
     243      if ($self->{$boolopt} =~ /^(?:true|false|t|f|on|off|yes|no)$/) {
     244        if ($self->{$boolopt} =~ /(?:true|t|on|yes)/) {
     245         $self->{$boolopt} = 1;
     246        } else {
     247         $self->{$boolopt} = 0;
     248        }
     249      } else {
     250        warn "Bad $boolopt setting $self->{$boolopt}\n";
     251        $self->{$boolopt} = 1;
     252      }
     253    }
     254  }
    237255
    238256  # Try to connect to the DB, and initialize a number of handy globals.
     
    12891307      $cfg->{rpcmode}           = $1 if /^rpc_mode\s*=\s*(socket|HTTP|XMLRPC)\s*$/i;
    12901308      $cfg->{maxfcgi}           = $1 if /^max_fcgi_requests\s*=\s*(\d+)\s*$/i;
     1309      $cfg->{force_refresh}     = $1 if /^force_refresh\s*=\s*([a-z01]+)/i;
    12911310      if (my ($tmp) = /^rpc_iplist\s*=\s*(.+)/i) {
    12921311        my @ips = split /[,\s]+/, $tmp;
     
    49204939
    49214940      # only update the cache file if the zone has changed, or if the cache file has nothing in it.
    4922       if ($changed || !-e $cachefile || -z $cachefile) {
     4941      if ($self->{force_refresh} || $changed || !-e $cachefile || -z $cachefile) {
    49234942        open ZONECACHE, ">$tmpcache" or die "Error creating temporary file $tmpcache: $!\n";
    49244943
     
    50015020
    50025021      # only update the cache file if the zone has changed, or if the cache file has nothing in it.
    5003       if ($changed || !-e $cachefile || -z $cachefile) {
     5022      if ($self->{force_refresh} || $changed || !-e $cachefile || -z $cachefile) {
    50045023        open ZONECACHE, ">$tmpcache" or die "Error creating temporary file $tmpcache: $!\n";
    50055024
Note: See TracChangeset for help on using the changeset viewer.