38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
/* All functions other than start() should be marked as
|
|
* private.
|
|
*/
|
|
class AirtimeDatabaseUpgrade{
|
|
|
|
public static function start(){
|
|
echo "* Updating Database".PHP_EOL;
|
|
self::task0();
|
|
self::task1();
|
|
}
|
|
|
|
private static function task0(){
|
|
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904');
|
|
|
|
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
|
UpgradeCommon::queryDb($sql);
|
|
}
|
|
|
|
/*
|
|
* set values for playout_status in cc_schedule
|
|
*/
|
|
private static function task1() {
|
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
|
|
|
$showInstances = CcShowInstancesQuery::create()
|
|
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
|
->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_EQUAL)
|
|
->find($con);
|
|
|
|
foreach ($showInstances as $instance) {
|
|
$instance->updateScheduleStatus($con);
|
|
}
|
|
}
|
|
|
|
}
|