Changeset 14018
- Timestamp:
- 04/25/12 12:23:22 (1 year ago)
- Files:
-
- modules/branches/2.11 (modified) (2 props)
- modules/branches/2.11/cdr/functions.inc.php (modified) (1 diff)
- modules/branches/2.11/cdr/install.php (modified) (3 diffs)
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 295 295 296 296 function cdr_export_csv($csvdata) { 297 global $db;298 297 // Searching for more than 10,000 records take more than 30 seconds. 299 298 // 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 27 27 $db_name = !empty($amp_conf['CDRDBNAME'])?$amp_conf['CDRDBNAME']:"asteriskcdrdb"; 28 28 $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 // 32 if (!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 29 48 if (! function_exists("out")) { 30 49 function out($text) { … … 34 53 out(_("Checking if field did is present in cdr table..")); 35 54 $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); 37 56 if (DB::IsError($confs)) { // no error... Already there 38 57 out(_("Adding did field to cdr")); 39 58 out(_("This might take a while......")); 40 59 $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); 42 61 if(DB::IsError($results)) { 43 62 die($results->getMessage()); … … 50 69 out(_("Checking if field recordingfile is present in cdr table..")); 51 70 $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); 53 72 if (DB::IsError($confs)) { // no error... Already there 54 73 out(_("Adding recordingfile field to cdr")); 55 74 $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); 57 76 if(DB::IsError($results)) { 58 77 out(_('Unable to add recordingfile field to cdr table'));
