Ticket #1792: sqlit3-new.patch

File sqlit3-new.patch, 4.1 kB (added by diego_iastrubni, 1 year ago)

new patch for sqlite3 support - problems...?

  • install.sql

    old new  
  • module.xml

    old new  
    11<module> 
    22        <rawname>ivr</rawname> 
    33        <name>IVR</name> 
    4         <version>2.5.14.2</version> 
     4        <version>2.6.0</version> 
    55        <type>setup</type> 
    66        <category>Inbound Call Control</category> 
    77        <description> 
    88                Creates Digital Receptionist (aka Auto-Attendant, aka Interactive Voice Response) menus. These can be used to send callers to different locations (eg, "Press 1 for sales") and/or allow direct-dialing of extension numbers.  
    99        </description> 
    1010        <changelog> 
     11                *2.6.0*  sane version, add SQLite3 support, fixes http://freepbx.org/trac/ticket/1792 
    1112                *2.5.14.2* merge findmefollow/core extension destinations if any 
    1213                *2.5.14.1* removed depends on 2.2.2 - classes are in all version of 2.3 
    1314                *2.5.14* add waitexten to 2.2 
  • uninstall.sql

    old new  
    1 DROP TABLE IF EXISTS ivr
    2 DROP TABLE IF EXISTS ivr_dests
     1DROP TABLE IF EXISTS `ivr`
     2DROP TABLE IF EXISTS `ivr_dests`
  • install.php

    old new  
    11<?php 
    2 sql('CREATE TABLE IF NOT EXISTS ivr ( ivr_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, displayname VARCHAR(50), deptname VARCHAR(50), enable_directory VARCHAR(8), enable_directdial VARCHAR(8), timeout INT, announcement VARCHAR(255), dircontext VARCHAR ( 50 ) DEFAULT "default" )'); 
    3 sql('CREATE TABLE IF NOT EXISTS ivr_dests ( ivr_id INT NOT NULL, selection VARCHAR(10), dest VARCHAR(50))'); 
    4  
    52global $db; 
    63 
     4// install the tables 
     5$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT":"AUTO_INCREMENT"; 
     6 
     7$sql = "CREATE TABLE IF NOT EXISTS ivr (  
     8        ivr_id INTEGER NOT NULL PRIMARY KEY $autoincrement,  
     9        displayname VARCHAR(50),  
     10        deptname VARCHAR(50),  
     11        enable_directory VARCHAR(8),  
     12        enable_directdial VARCHAR(8),  
     13        timeout INTEGER,  
     14        announcement VARCHAR(255),  
     15        dircontext VARCHAR ( 50 ) DEFAULT \"default\"  
     16);"; 
     17$check = $db->query($sql); 
     18if (DB::IsError($check)) { 
     19        die( "Can not create `ivr` table: " . $check->getMessage() .  "\n"); 
     20} 
     21 
     22$sql = "CREATE TABLE IF NOT EXISTS ivr_dests (  
     23        ivr_id INTEGER NOT NULL,  
     24        selection VARCHAR(10),  
     25        dest VARCHAR(50),  
     26        ivr_ret TINYINT(1) NOT NULL DEFAULT 0 
     27);"; 
     28$check = $db->query($sql); 
     29if (DB::IsError($check)) { 
     30        die( "Can not create `ivrdests` table: " . $check->getMessage() .  "\n"); 
     31} 
     32 
     33$ivr_modcurrentvers = modules_getversion('ivr'); 
     34 
    735// Now, we need to check for upgrades.  
    836// V1.0, old IVR. You shouldn't see this, but check for it anyway, and assume that it's 2.0 
    937// V2.0, Original Release 
     
    1139// v2.2, announcement changed to support filenames instead of ID's from recordings table 
    1240//  
    1341 
    14 $ivr_modcurrentvers = modules_getversion('ivr'); 
    15  
    1642// Add the col 
    1743$sql = "SELECT dircontext FROM ivr"; 
    1844$check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     
    2551    } 
    2652} 
    2753 
    28 if (version_compare($ivr_modcurrentvers, "2.2", "<")) { 
     54if ( ($ivr_modcurrentvers != "") &&  (version_compare($ivr_modcurrentvers, "2.2", "<")) ) { 
    2955        //echo "<p>Start 2.2 upgrade</p>"; 
    3056        $sql = "ALTER TABLE ivr CHANGE COLUMN announcement announcement VARCHAR ( 255 )"; 
    3157    $result = $db->query($sql); 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads