forked from FreePBX/superfecta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
47 lines (43 loc) · 1.36 KB
/
uninstall.php
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
45
46
47
Caller ID Superfecta is being uninstalled.<br>
<?php
global $db;
global $amp_conf;
global $astman;
if(!function_exists("out"))
{
function out($text)
{
echo $text."<br />";
}
}
if (! function_exists("outn")) {
function outn($text) {
echo $text;
}
}
// drop the tables
$sql = "DROP TABLE IF EXISTS superfectaconfig";
$check = $db->query($sql);
if (DB::IsError($check))
{
die_freepbx( "Can not delete superfectaconfig table: " . $check->getMessage() . "\n");
}
$sql = "DROP TABLE IF EXISTS superfectacache";
$check = $db->query($sql);
if (DB::IsError($check))
{
die_freepbx( "Can not delete superfectacache table: " . $check->getMessage() . "\n");
}
print 'Deleting Caller ID Superfecta Inbound Route Assignments, and performing general cleanup.<br>';
//delete incoming lookups
$sql = "delete c1 from cidlookup_incoming c1, cidlookup c2 where c1.cidlookup_id = c2.cidlookup_id and c2.description =
'Caller ID Superfecta'";
$res = $db->query($sql);
//delete the line from the cidlookup table
$sql = "DELETE FROM cidlookup WHERE description = 'Caller ID Superfecta'";
$res = $db->query($sql);
//cleanup stray cidlookup_incoming records left by bad uninstalls
$sql = "delete c1 from cidlookup_incoming c1 left outer join cidlookup c2 on c1.cidlookup_id = c2.cidlookup_id where
c2.cidlookup_id is null";
$res = $db->query($sql);
?>