Skip to content

Commit

Permalink
Fix to use more simplified version
Browse files Browse the repository at this point in the history
87a2ad9#commitcomment-143437560

Revert "Fix to correctly handle fractional values"

This reverts commit 2e2a145.
  • Loading branch information
iliajie committed Jun 23, 2024
1 parent f443315 commit e57b4b9
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions disable-domain.pl
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,15 @@ package virtual_server;
&unlock_domain($d);
print ".. done\n";
}
elsif ($schedule =~ /^(?<ts>\d+(?:\.\d+)?)$/ &&
($+{ts} > time() ||
($+{ts} > 0 && $+{ts} < 365*10))) {
# Schedule a disable
my $ts = $+{ts};
# If timestamp is in days
if ($ts < 365*10) {
$ts = time() + $ts * 86400;
}
elsif ($schedule =~ /^(\d+(?:\.\d+)?)$/) {
# Schedule can either be a timestamp or a number of days
$schedule = time() + int($schedule * 86400)
if ($schedule < 365*10);
$schedule > time() || &usage("Disable time must be in the future");
my $amsg = $d->{'disabled_auto'} ? "Updating" : "Setting";
print "$amsg up disable schedule for $d->{'dom'} to @{[&make_date($ts)]} ..\n";
print "$amsg up disable schedule for $d->{'dom'} to @{[&make_date($schedule)]} ..\n";
&lock_domain($d);
$d->{'disabled_auto'} = $ts;
$d->{'disabled_auto'} = $schedule;
&save_domain($d);
&unlock_domain($d);
print ".. done\n";
Expand Down

0 comments on commit e57b4b9

Please sign in to comment.