Todo for consistency.
This commit is contained in:
parent
99a3a8deab
commit
a3d4b8c722
|
@ -167,26 +167,33 @@ class Application_Model_ShowInstance
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$instance_id = $this->getShowInstanceId();
|
$instance_id = $this->getShowInstanceId();
|
||||||
$sql = "SELECT starts from cc_schedule"
|
$sql = <<<SQL
|
||||||
." WHERE instance_id = $instance_id"
|
SELECT starts
|
||||||
." ORDER BY starts"
|
FROM cc_schedule
|
||||||
." LIMIT 1";
|
WHERE instance_id = :instanceId
|
||||||
|
ORDER BY starts LIMIT 1;
|
||||||
$scheduleStarts = $con->query($sql)->fetchColumn(0);
|
SQL;
|
||||||
|
$scheduleStarts = Application_Common_Database::prepareAndExecute( $sql,
|
||||||
|
array( ':instanceId' => $instance_id ), 'column' );
|
||||||
|
|
||||||
if ($scheduleStarts) {
|
if ($scheduleStarts) {
|
||||||
$scheduleStartsEpoch = strtotime($scheduleStarts);
|
$scheduleStartsEpoch = strtotime($scheduleStarts);
|
||||||
$showStartsEpoch = strtotime($this->getShowInstanceStart());
|
$showStartsEpoch = strtotime($this->getShowInstanceStart());
|
||||||
|
|
||||||
$diff = $showStartsEpoch - $scheduleStartsEpoch;
|
$diff = $showStartsEpoch - $scheduleStartsEpoch;
|
||||||
|
|
||||||
if ($diff != 0) {
|
if ($diff != 0) {
|
||||||
$sql = "UPDATE cc_schedule"
|
$sql = <<<SQL
|
||||||
." SET starts = starts + INTERVAL '$diff' second,"
|
UPDATE cc_schedule
|
||||||
." ends = ends + INTERVAL '$diff' second"
|
SET starts = starts + INTERVAL :diff1 SECOND,
|
||||||
." WHERE instance_id = $instance_id";
|
ends = ends + INTERVAL :diff2 SECOND
|
||||||
|
WHERE instance_id = :instanceId
|
||||||
$con->exec($sql);
|
SQL;
|
||||||
|
Application_Common_Database::prepareAndExecute($sql,
|
||||||
|
array(
|
||||||
|
':diff1' => $diff,
|
||||||
|
':diff2' => $diff,
|
||||||
|
':instanceId' => $instance_id ), 'execute');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
|
Loading…
Reference in New Issue