Changeset 5891

Show
Ignore:
Timestamp:
07/02/08 15:44:43 (3 months ago)
Author:
lazytt
Message:

#1794

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/recordings/functions.inc.php

    r5335 r5891  
    104104                $fname = $filename; 
    105105        } 
    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 
    107108        return true; 
    108109         
  • modules/branches/2.5/recordings/install.php

    r4767 r5891  
    66$recordings_astsnd_path = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk'; 
    77$recordings_astsnd_path .= "/sounds/"; 
     8$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT":"AUTO_INCREMENT"; 
    89 
    910 
     
    2324 
    2425// 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;"; 
    2632$result = $db->query($sql); 
    2733if(DB::IsError($result)) { 
     
    4349$results = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
    4450if (!isset($results['filename'])) { 
    45        sql("INSERT INTO recordings values ('', '__invalid', 'install done', '')"); 
     51       sql("INSERT INTO recordings (displayname, filename, description) VALUES ( '__invalid', 'install done', '');" ); 
    4652        $dh = opendir($recordings_directory); 
    4753        while (false !== ($file = readdir($dh))) { // http://au3.php.net/readdir  
     
    6066// Upgrade to recordings 3.0 
    6167// 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. 
     72if  (($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 } 
    6880?> 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads