Here is how to keep the rclog file small.
Note that this patch contains a line saying </" . "pre>
-- this can be replaced by </pre>
. It was necessary to
hide the closing pre tag...
sub DoMaintain { my ($name, $fname, @rc, @temp, $starttime, $days, $status, $data, $i, $ts); ... # Determine the number of days to go back $days = 0; foreach (@RcDays) { $days = $_ if $_ > $days; } $starttime = $Now - $days * 24 * 60 * 60; # Read the current file ($status, $data) = &ReadFile($RcFile); if (!$status) { print '<p><strong>' . Ts('Could not open %s log file', $RCName) . ":</strong> $RcFile<p>" . T('Error was') . ":\n<pre>$!</" . "pre>\n" . '<p>' . T('Note: This error is normal if no changes have been made.') . "\n"; } # Move the old stuff from rc to temp @rc = split(/\n/, $data); for ($i = 0; $i < @rc ; $i++) { ($ts) = split(/$FS3/, $rc[$i]); last if ($ts >= $starttime); } @temp = splice(@rc, 0, $i); # Write new files, and backups if (!open(OUT, ">>$RcOldFile")) { die(Ts('%s log error:', $RCName) . " $!"); } print OUT join("\n",@temp) . "\n"; close(OUT); &WriteStringToFile($RcFile . '.old', $data); &WriteStringToFile($RcFile, join("\n",@rc) . "\n"); # Write timestamp &WriteStringToFile($fname, 'Maintenance done at ' . &TimeToText($Now)); &ReleaseLock(); ... }