Changeset 14018

Show
Ignore:
Timestamp:
04/25/12 12:23:22 (1 year ago)
Author:
p_lindheimer
Message:

Merged revisions 14017 via svnmerge from
http://www.freepbx.org/v2/svn/modules/branches/2.10

........

r14017 | p_lindheimer | 2012-04-25 09:20:54 -0700 (Wed, 25 Apr 2012) | 1 line


make sure install script all uses remote db for any migrations re #5788

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.11

    • Property svn:mergeinfo changed from /modules/branches/2.10:13727-13773,13779-13787,13791-13852,13855-13967 to /modules/branches/2.10:13727-13773,13779-13787,13791-13852,13855-13967,14017
    • Property svnmerge-integrated changed from /modules/branches/2.10:1-13969 /modules/branches/2.9:1-12787 to /modules/branches/2.10:1-13969,14017 /modules/branches/2.9:1-12787
  • modules/branches/2.11/cdr/functions.inc.php

    r13976 r14018  
    295295 
    296296function cdr_export_csv($csvdata) { 
    297   global $db; 
    298297  // Searching for more than 10,000 records take more than 30 seconds. 
    299298  // php default timeout is 30 seconds, hard code it to 3000 seconds for now (which is WAY overkill). 
  • modules/branches/2.11/cdr/install.php

    r13976 r14018  
    2727$db_name = !empty($amp_conf['CDRDBNAME'])?$amp_conf['CDRDBNAME']:"asteriskcdrdb"; 
    2828$db_table_name = !empty($amp_conf['CDRDBTABLENAME'])?$amp_conf['CDRDBTABLENAME']:"cdr"; 
     29 
     30// if CDRDBHOST and CDRDBTYPE are not empty then we assume an external connection and don't use the default connection 
     31// 
     32if (!empty($amp_conf["CDRDBHOST"]) && !empty($amp_conf["CDRDBTYPE"])) { 
     33  $db_hash = array('mysql' => 'mysql', 'postgres' => 'pgsql'); 
     34  $db_type = $db_hash[$amp_conf["CDRDBTYPE"]]; 
     35  $db_host = $amp_conf["CDRDBHOST"]; 
     36  $db_port = empty($amp_conf["CDRDBPORT"]) ? '' :  ':' . $amp_conf["CDRDBPORT"]; 
     37  $db_user = empty($amp_conf["CDRDBUSER"]) ? $amp_conf["AMPDBUSER"] : $amp_conf["CDRDBUSER"]; 
     38  $db_pass = empty($amp_conf["CDRDBPASS"]) ? $amp_conf["AMPDBPASS"] : $amp_conf["CDRDBPASS"]; 
     39  $datasource = $db_type . '://' . $db_user . ':' . $db_pass . '@' . $db_host . $db_port . '/' . $db_name; 
     40  $dbcdr = DB::connect($datasource); // attempt connection 
     41  if(DB::isError($dbcdr)) { 
     42    die_freepbx($dbcdr->getDebugInfo());  
     43  } 
     44} else { 
     45  $dbcdr = $db; 
     46} 
     47 
    2948if (! function_exists("out")) { 
    3049        function out($text) { 
     
    3453out(_("Checking if field did is present in cdr table..")); 
    3554$sql = "SELECT did FROM $db_name.$db_table_name"; 
    36 $confs = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     55$confs = $dbcdr->getRow($sql, DB_FETCHMODE_ASSOC); 
    3756if (DB::IsError($confs)) { // no error... Already there 
    3857  out(_("Adding did field to cdr")); 
    3958  out(_("This might take a while......")); 
    4059  $sql = "ALTER TABLE $db_name.$db_table_name ADD did VARCHAR ( 50 ) NOT NULL DEFAULT ''"; 
    41   $results = $db->query($sql); 
     60  $results = $dbcdr->query($sql); 
    4261  if(DB::IsError($results)) { 
    4362    die($results->getMessage()); 
     
    5069out(_("Checking if field recordingfile is present in cdr table..")); 
    5170$sql = "SELECT recordingfile FROM $db_name.$db_table_name"; 
    52 $confs = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     71$confs = $dbcdr->getRow($sql, DB_FETCHMODE_ASSOC); 
    5372if (DB::IsError($confs)) { // no error... Already there 
    5473    out(_("Adding recordingfile field to cdr")); 
    5574    $sql = "ALTER TABLE $db_name.$db_table_name ADD recordingfile VARCHAR ( 255 ) NOT NULL DEFAULT ''"; 
    56     $results = $db->query($sql); 
     75    $results = $dbcdr->query($sql); 
    5776    if(DB::IsError($results)) { 
    5877        out(_('Unable to add recordingfile field to cdr table'));