CVS: ispman/lib/ISPMan/DNSMan SOArecords.pm,1.14,1.15
Tarjei Huse <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/lib/ISPMan/DNSMan
In directory sc8-pr-cvs1:/tmp/cvs-serv14327/lib/ISPMan/DNSMan
Modified Files:
SOArecords.pm
Log Message:
The patches also sent to the list
Index: SOArecords.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/DNSMan/SOArecords.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** SOArecords.pm 30 Jul 2002 02:06:54 -0000 1.14
--- SOArecords.pm 2 Jan 2004 14:34:00 -0000 1.15
***************
*** 13,16 ****
--- 13,17 ----
touchSOA
setDNSsOARecord
+ updateSOASerial
);
$VERSION = '0.01';
***************
*** 43,51 ****
my $self=shift;
my $r=shift;
!
$self->delTree($self->getsOARecordDn($r->param("ispmanDomain")));
$self->setDNSsOARecord($r->param("ispmanDomain"), $r->param('primary'),
$r->param('rootmail'),
! time(),
$r->param('refresh'),
$r->param('retry'),
--- 44,54 ----
my $self=shift;
my $r=shift;
! my $soa=$self->getSOA($r->param('ispmanDomain'));
! $soa->{'serial'} = $self->updateSOASerial($soa->{'serial'});
!
$self->delTree($self->getsOARecordDn($r->param("ispmanDomain")));
$self->setDNSsOARecord($r->param("ispmanDomain"), $r->param('primary'),
$r->param('rootmail'),
! $soa->{'serial'},
$r->param('refresh'),
$r->param('retry'),
***************
*** 90,98 ****
my $soa=$self->getSOA($domain);
$self->delTree($self->getsOARecordDn($domain));
$self->setDNSsOARecord($domain,
$soa->{'primary'},
$soa->{'rootmail'},
! time(),
$soa->{'refresh'},
$soa->{'retry'},
--- 93,103 ----
my $soa=$self->getSOA($domain);
+ $soa->{'serial'} = $self->updateSOASerial($soa->{'serial'});
+
$self->delTree($self->getsOARecordDn($domain));
$self->setDNSsOARecord($domain,
$soa->{'primary'},
$soa->{'rootmail'},
! $soa->{'serial'},
$soa->{'refresh'},
$soa->{'retry'},
***************
*** 111,114 ****
--- 116,151 ----
}
+ # updateSOASerial - generates the correct serial for the record.
+ # correct format: YYYYMMDDnn
+ sub updateSOASerial {
+ my $self=shift;
+ my $serial=shift;
+
+ if ($self->{'Config'}->{'DNSSerialFormat'} eq 'timestamp') {
+ return time();
+ }
+
+ my @localtime = localtime();
+ my $year = $localtime[5] + 1900;
+ my $month = $localtime[4] + 1;
+ my $day = $localtime[3] ;
+
+ my $index = substr($serial,-2,2);
+ my $olddate = substr($serial,0,8);
+
+ $day = "0$day" if ($day < 10);
+ $month = "0$month" if ($month < 10);
+
+ my $newdate = $year.$month.$day;
+
+ if ($olddate ne $newdate) {
+ $serial = $newdate."01";
+ } elsif ($olddate == $newdate) {
+ $index++;
+ $serial = $olddate . $index;
+ }
+
+ return $serial;
+ }
1;
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click