-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathuninstall.php
37 lines (29 loc) · 1.12 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
<?php
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
// Delete all the followme trees. This function selects from the users table
// and not the findmefollow table because the uninstall code deletes the tables
// prior to running the uninstall script. (probably should be the opposite but...)
// It is probably better this way anyhow, as there is no harm done if the user
// has not followme settings and who knows ... maybe some stray ones got left
// behind somehow.
// TODO, is this needed...?
// is this global...? what if we include this files
// from a function...?
global $astman;
global $amp_conf;
// Don't bother uninstalling feature codes, now module_uninstall does it
$sql = "SELECT * FROM users";
$userresults = sql($sql,"getAll",DB_FETCHMODE_ASSOC);
//add details to astdb
if ($astman) {
foreach($userresults as $usr) {
extract($usr);
if(isset($grpnum)) {
$astman->database_deltree("AMPUSER/".$grpnum."/followme");
}
}
} else {
echo _("Cannot connect to Asterisk Manager with ").$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"];
}
sql('DROP TABLE IF EXISTS findmefollow');
?>