-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.php
More file actions
44 lines (38 loc) · 1.25 KB
/
install.php
File metadata and controls
44 lines (38 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
global $db;
$sql = "SELECT * FROM `queuemetrics_options` LIMIT 1";
$check = $db->query($sql);
if(!DB::IsError($check)) {
out(_("queuemetrics table already exists, exiting"));
} else {
unset($sql);
$sql[] = "CREATE TABLE IF NOT EXISTS `queuemetrics_options` (
`keyword` VARCHAR(25),
`value` TEXT,
UNIQUE KEY `keyword` (`keyword`)
)";
foreach ($sql as $q) {
$result = $db->query($q);
if($db->IsError($result)){
die_freepbx($result->getDebugInfo());
}
}
outn(_("creating queuemetrics...ok"));
}
// sysadmin migration
outn(_("checking for ivr_logging field..."));
$sql = "SELECT `keyword` FROM `queuemetrics_options` where `keyword` = 'ivr_logging'";
$check = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if($db->IsError($check) || empty($check)) {
// add new field
$sql = "INSERT INTO `queuemetrics_options` (`keyword`, value) VALUES ('ivr_logging', '0');";
$result = $db->query($sql);
if($db->IsError($result)) {
die_freepbx($result->getDebugInfo());
}
out(_("OK"));
} else {
out(_("already exists"));
}
?>