<?php
$tickets = $bugDatabase->getTicketList(); // get all tickets. this will be huge. :)
while (list($key, $ticket) = each($tickets)) {
buginError("Running triggers for ticket {$ticket['id']}", MESSAGE_DEBUG);
$run = runTriggers(TRIGGER_FLAG_TIME, $ticket);
if (count($run)) {
$mod = $run['mod'];
if (isset($run['notifyList']))
runNotify($ticket, $ticket, $run['mod'], $run['notifyList']);
if (isset($mod['modification'])) {
// Update the ticket...
$update = array();
$update[0]['action'] = "add";
$update[0]['tableName'] = "modifications";
$update[0]['modify'][0]['fieldName'] = "uid";
$update[0]['modify'][0]['fieldValue'] = USER_SCHEDULER;
$update[0]['modify'][1]['fieldName'] = "text";
$update[0]['modify'][1]['fieldValue'] = $bugDatabase->db->qstr($mod['modification']);
$update[0]['modify'][2]['fieldName'] = "ts";
$update[0]['modify'][2]['fieldValue'] = $bugDatabase->db->DBTimeStamp(time());
$update[0]['modify'][3]['fieldName'] = "ticket_id";
$update[0]['modify'][3]['fieldValue'] = $ticket['id'];
// Update the time stamp....
$update[1]['action'] = "change";
$update[1]['tableName'] = "tickets";
$update[1]['uniqueRow'] = "id";
$update[1]['rowid'] = $ticket['id'];
$update[1]['modify'][0]['fieldName'] = "date_modified";
$update[1]['modify'][0]['fieldValue'] = $bugDatabase->db->DBTimeSTamp(time());
$bugDatabase->alterDb($update);
}
}
}
?>