Changeset 5891
- Timestamp:
- 07/02/08 15:44:43 (3 months ago)
- Files:
-
- modules/branches/2.5/recordings/functions.inc.php (modified) (1 diff)
- modules/branches/2.5/recordings/install.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.5/recordings/functions.inc.php
r5335 r5891 104 104 $fname = $filename; 105 105 } 106 sql("INSERT INTO recordings values ('', '$displayname', '$fname', 'No long description available')"); 106 sql("INSERT INTO recordings (displayname, filename, description) VALUES ( '$displayname', '$fname', 'No long description available')"); 107 107 108 return true; 108 109 modules/branches/2.5/recordings/install.php
r4767 r5891 6 6 $recordings_astsnd_path = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk'; 7 7 $recordings_astsnd_path .= "/sounds/"; 8 $autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT":"AUTO_INCREMENT"; 8 9 9 10 … … 23 24 24 25 // Make sure table exists 25 $sql = "CREATE TABLE IF NOT EXISTS recordings ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, displayname VARCHAR(50) , filename BLOB, description VARCHAR(254));"; 26 $sql = "CREATE TABLE IF NOT EXISTS recordings ( 27 id INTEGER NOT NULL PRIMARY KEY $autoincrement, 28 displayname VARCHAR(50) , 29 filename BLOB, 30 description VARCHAR(254)) 31 ;"; 26 32 $result = $db->query($sql); 27 33 if(DB::IsError($result)) { … … 43 49 $results = $db->getRow($sql, DB_FETCHMODE_ASSOC); 44 50 if (!isset($results['filename'])) { 45 sql("INSERT INTO recordings values ('', '__invalid', 'install done', '')");51 sql("INSERT INTO recordings (displayname, filename, description) VALUES ( '__invalid', 'install done', '');" ); 46 52 $dh = opendir($recordings_directory); 47 53 while (false !== ($file = readdir($dh))) { // http://au3.php.net/readdir … … 60 66 // Upgrade to recordings 3.0 61 67 // Change filename from VARCHAR(80) to BLOB 62 $sql = 'ALTER TABLE recordings CHANGE filename filename BLOB'; 63 $result = $db->query($sql); 64 if(DB::IsError($result)) { 65 die_freepbx($result->getDebugInfo()); 66 } 67 68 // Upgrade to recordings 3.0 69 // Change filename from VARCHAR(80) to BLOB 70 // no need to add this if we are on sqlite, since the initial tables will 71 // include the correct columns already. 72 if (($amp_conf["AMPDBENGINE"] != "sqlite") && ($amp_conf["AMPDBENGINE"] != "sqlite3")) 73 { 74 $sql = 'ALTER TABLE recordings CHANGE filename filename BLOB'; 75 $result = $db->query($sql); 76 if(DB::IsError($result)) { 77 die($result->getDebugInfo()); 78 } 79 } 68 80 ?>
