From 6943120fc6bf4157ccbd5a5c4e0c34fc867dc1b9 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 3 Apr 2012 14:59:52 -0400 Subject: [PATCH] CC-3422: Upgrade Script: add/enhance upgrade script for relay stream feature - done --- .../upgrades/airtime-2.1.0/DbUpgrade.php | 4 +++- .../airtime-2.1.0/common/UpgradeCommon.php | 16 ++++++++++++++-- .../common/Version20120403143635.php | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php index bff331446..c26115787 100644 --- a/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php +++ b/install_minimal/upgrades/airtime-2.1.0/DbUpgrade.php @@ -11,7 +11,9 @@ class AirtimeDatabaseUpgrade{ } private static function task0(){ - UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120402103944'); + UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120403143635'); + $sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')"; + UpgradeCommon::nonSelectQueryDb($sql); } } diff --git a/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php b/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php index bf60607bd..cc8ee35e0 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/UpgradeCommon.php @@ -21,7 +21,7 @@ class UpgradeCommon{ { $sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'"; - $result = self::queryDb($sql); + $result = self::selectQueryDb($sql); $timezone = $result['valstr']; date_default_timezone_set($timezone); @@ -238,7 +238,7 @@ class UpgradeCommon{ fclose($fp); } - public static function queryDb($p_sql){ + public static function selectQueryDb($p_sql){ global $CC_DBC; $result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC); @@ -249,4 +249,16 @@ class UpgradeCommon{ return $result; } + + public static function nonSelectQueryDb($p_sql){ + global $CC_DBC; + + $result = $CC_DBC->query($p_sql); + if (PEAR::isError($result)) { + echo "Error executing $sql. Exiting."; + exit(1); + } + + return $result; + } } diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php index 6ea644f31..9e5b19517 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php @@ -12,8 +12,8 @@ class Version20120403143635 extends AbstractMigration $cc_show = $schema->getTable('cc_show'); $cc_show->addColumn('live_stream_using_airtime_auth', 'boolean', array('default'=> 'false')); $cc_show->addColumn('live_stream_using_custom_auth', 'boolean', array('default'=> 'false')); - $cc_show->addColumn('live_stream_user', 'string', array('length' => 255)); - $cc_show->addColumn('live_stream_pass', 'string', array('length' => 255)); + $cc_show->addColumn('live_stream_user', 'string', array('notnull' => 0, 'length' => 255)); + $cc_show->addColumn('live_stream_pass', 'string', array('notnull' => 0, 'length' => 255)); } public function down(Schema $schema)