cron scripts: replace fwrite'ing to lockfile by logging

This commit is contained in:
Daniel Reichelt
2016-02-16 15:04:20 +01:00
parent f65af0067d
commit f86a115c6a
10 changed files with 56 additions and 95 deletions

View File

@@ -20,7 +20,7 @@
/**
* ARCHIVING CLOSED TICKETS
*/
fwrite($debugHandler, 'Ticket-archiving run started...' . "\n");
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Ticket-archiving run started...');
$result_tickets_stmt = Database::query("
SELECT `id`, `lastchange`, `subject` FROM `" . TABLE_PANEL_TICKETS . "`
WHERE `status` = '3' AND `answerto` = '0';"
@@ -35,7 +35,7 @@ while ($row_ticket = $result_tickets_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($days >= Settings::Get('ticket.archiving_days')) {
fwrite($debugHandler, 'archiving ticket "' . $row_ticket['subject'] . '" (ID #' . $row_ticket['id'] . ')' . "\n");
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'archiving ticket "' . $row_ticket['subject'] . '" (ID #' . $row_ticket['id'] . ')');
$mainticket = ticket::getInstanceOf(null, (int)$row_ticket['id']);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '1', true, true);
@@ -46,7 +46,7 @@ while ($row_ticket = $result_tickets_stmt->fetch(PDO::FETCH_ASSOC)) {
}
}
fwrite($debugHandler, 'Archived ' . $archiving_count . ' tickets' . "\n");
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Archived ' . $archiving_count . ' tickets');
Database::query("
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = UNIX_TIMESTAMP()
WHERE `settinggroup` = 'system' AND `varname` = 'last_archive_run'"