From e4d3179227b31986b53c8bc98eafb55ecf1fadd6 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 3 Jan 2007 22:47:25 +0000 Subject: [PATCH] Beginning of fix for #2106 - Scheduler database tables are created in a different way than all other tables. --- .../src/modules/storageServer/var/conf.php | 3 ++ .../storageServer/var/conf.php.template | 3 ++ .../var/install/installScheduler.php | 54 +++++++++++++++++++ .../var/install/uninstallScheduler.php | 36 +++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 campcaster/src/modules/storageServer/var/install/installScheduler.php create mode 100644 campcaster/src/modules/storageServer/var/install/uninstallScheduler.php diff --git a/campcaster/src/modules/storageServer/var/conf.php b/campcaster/src/modules/storageServer/var/conf.php index 6896c3d7a..881abb10a 100644 --- a/campcaster/src/modules/storageServer/var/conf.php +++ b/campcaster/src/modules/storageServer/var/conf.php @@ -132,6 +132,9 @@ $CC_CONFIG['treeTable'] = $CC_CONFIG['tblNamePrefix'].'tree'; $CC_CONFIG['structTable'] = $CC_CONFIG['tblNamePrefix'].'struct'; $CC_CONFIG['transTable'] = $CC_CONFIG['tblNamePrefix'].'trans'; $CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref'; +$CC_CONFIG['playlogTable'] = 'playlog'; +$CC_CONFIG['scheduleTable'] = 'schedule'; +$CC_CONFIG['backupTable'] = 'backup'; $CC_CONFIG['sysSubjs'] = array( 'root', $CC_CONFIG['AdminsGr'], $CC_CONFIG['AllGr'], $CC_CONFIG['StationPrefsGr'] diff --git a/campcaster/src/modules/storageServer/var/conf.php.template b/campcaster/src/modules/storageServer/var/conf.php.template index 2992fad6f..88cb02665 100644 --- a/campcaster/src/modules/storageServer/var/conf.php.template +++ b/campcaster/src/modules/storageServer/var/conf.php.template @@ -132,6 +132,9 @@ $CC_CONFIG['treeTable'] = $CC_CONFIG['tblNamePrefix'].'tree'; $CC_CONFIG['structTable'] = $CC_CONFIG['tblNamePrefix'].'struct'; $CC_CONFIG['transTable'] = $CC_CONFIG['tblNamePrefix'].'trans'; $CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref'; +$CC_CONFIG['playlogTable'] = 'playlog'; +$CC_CONFIG['scheduleTable'] = 'schedule'; +$CC_CONFIG['backupTable'] = 'backup'; $CC_CONFIG['sysSubjs'] = array( 'root', $CC_CONFIG['AdminsGr'], $CC_CONFIG['AllGr'], $CC_CONFIG['StationPrefsGr'] diff --git a/campcaster/src/modules/storageServer/var/install/installScheduler.php b/campcaster/src/modules/storageServer/var/install/installScheduler.php new file mode 100644 index 000000000..2c4aeba70 --- /dev/null +++ b/campcaster/src/modules/storageServer/var/install/installScheduler.php @@ -0,0 +1,54 @@ +query($sql); + echo "done.\n"; +} else { + echo " * Skipping: database table already exists: ".$CC_CONFIG['scheduleTable']."\n"; +} + + +if (!camp_db_table_exists($CC_CONFIG['playlogTable'])) { + echo " * Creating database table ".$CC_CONFIG['playlogTable']."..."; + $sql = "CREATE TABLE ".$CC_CONFIG['playLogTable']."(" + ." id BIGINT NOT NULL," + ." audioClipId BIGINT NOT NULL," + ." timestamp TIMESTAMP NOT NULL," + ." PRIMARY KEY(id))"; + $CC_DBC->query($sql); + echo "done.\n"; +} else { + echo " * Skipping: database table already exists: ".$CC_CONFIG['playlogTable']."\n"; +} + + +if (!camp_db_table_exists($CC_CONFIG['backupTable'])) { + echo " * Creating database table ".$CC_CONFIG['backupTable']."..."; + $sql = "CREATE TABLE ".$CC_CONFIG['backupTable']." (" + ." token VARCHAR(64) NOT NULL," + ." sessionId VARCHAR(64) NOT NULL," + ." status VARCHAR(32) NOT NULL," + ." fromTime TIMESTAMP NOT NULL," + ." toTime TIMESTAMP NOT NULL," + ." PRIMARY KEY(token))"; + $CC_DBC->query($sql); + echo "done.\n"; +} else { + echo " * Skipping: database table already exists: ".$CC_CONFIG['backupTable']."\n"; +} +?> \ No newline at end of file diff --git a/campcaster/src/modules/storageServer/var/install/uninstallScheduler.php b/campcaster/src/modules/storageServer/var/install/uninstallScheduler.php new file mode 100644 index 000000000..ffaa0b147 --- /dev/null +++ b/campcaster/src/modules/storageServer/var/install/uninstallScheduler.php @@ -0,0 +1,36 @@ +query("DROP TABLE ".$CC_CONFIG['scheduleTable']); + echo "done.\n"; +} else { + echo " * Skipping: database table ".$CC_CONFIG['scheduleTable']."\n"; +} + +if (camp_db_table_exists($CC_CONFIG['backupTable'])) { + echo " * Removing database table ".$CC_CONFIG['backupTable']."..."; + $CC_DBC->query("DROP TABLE ".$CC_CONFIG['backupTable']); + echo "done.\n"; +} else { + echo " * Skipping: database table ".$CC_CONFIG['backupTable']."\n"; +} + +if (camp_db_table_exists($CC_CONFIG['playlogTable'])) { + echo " * Removing database table ".$CC_CONFIG['playlogTable']."..."; + $CC_DBC->query("DROP TABLE ".$CC_CONFIG['playlogTable']); + echo "done.\n"; +} else { + echo " * Skipping: database table ".$CC_CONFIG['playlogTable']."\n"; +} + +?> \ No newline at end of file