|
34 | 34 |
|
35 | 35 | error_reporting(E_ALL|E_STRICT); |
36 | 36 |
|
37 | | -require_once "/usr/local/ispconfig/server/lib/config.inc.php"; |
38 | | -require_once "/usr/local/ispconfig/server/lib/app.inc.php"; |
39 | | - |
40 | 37 | //** The banner on the command line |
41 | 38 | echo "\n\n".str_repeat('-', 80)."\n"; |
42 | 39 | echo " _____ ___________ _____ __ _ ____ |
|
50 | 47 | echo "\n".str_repeat('-', 80)."\n"; |
51 | 48 | echo "\n\n>> Uninstall \n\n"; |
52 | 49 |
|
53 | | -echo "Are you sure you want to uninsatll ISPConfig? [no]"; |
54 | | -$input = fgets(STDIN); |
55 | | -$do_uninstall = rtrim($input); |
| 50 | +require "/usr/local/ispconfig/server/lib/config.inc.php"; |
| 51 | +require "/usr/local/ispconfig/server/lib/app.inc.php"; |
| 52 | +require "/usr/local/ispconfig/server/mysql_clientdb.conf"; |
| 53 | + |
| 54 | +// Delete the ISPConfig database |
| 55 | +//exec("/etc/init.d/mysql stop"); |
| 56 | +//exec("rm -rf /var/lib/mysql/".$conf["db_database"]); |
| 57 | +//exec("/etc/init.d/mysql start"); |
| 58 | +$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password); |
| 59 | +if (!$link) { |
| 60 | + echo "Unable to connect to the database'.mysql_error($link)"; |
| 61 | +} else { |
| 62 | + $result=mysql_query("DROP DATABASE ".$conf['db_database']."';", $link); |
| 63 | + if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysql_error($link)."\n"; |
| 64 | + $result=mysql_query("DROP USER '".$conf['db_user'] ."';"); |
| 65 | + if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysql_error($link)."\n"; |
| 66 | +} |
| 67 | +mysql_close($link); |
56 | 68 |
|
| 69 | +// Deleting the symlink in /var/www |
| 70 | +// Apache |
| 71 | +@unlink("/etc/apache2/sites-enabled/000-ispconfig.vhost"); |
| 72 | +@unlink("/etc/apache2/sites-available/ispconfig.vhost"); |
| 73 | +@unlink("/etc/apache2/sites-enabled/000-apps.vhost"); |
| 74 | +@unlink("/etc/apache2/sites-available/apps.vhost"); |
57 | 75 |
|
58 | | -if($do_uninstall == 'yes') { |
| 76 | +// nginx |
| 77 | +@unlink("/etc/nginx/sites-enabled/000-ispconfig.vhost"); |
| 78 | +@unlink("/etc/nginx/sites-available/ispconfig.vhost"); |
| 79 | +@unlink("/etc/nginx/sites-enabled/000-apps.vhost"); |
| 80 | +@unlink("/etc/nginx/sites-available/apps.vhost"); |
59 | 81 |
|
60 | | - echo "\n\n>> Uninstalling ISPConfig 3... \n\n"; |
| 82 | +// Delete the ispconfig files |
| 83 | +exec('rm -rf /usr/local/ispconfig'); |
61 | 84 |
|
62 | | - // Delete the ISPConfig database |
63 | | - // $app->db->query("DROP DATABASE '".$conf["db_database"]."'"); |
64 | | - // $app->db->query("DELETE FROM mysql.user WHERE User = 'ispconfig'"); |
65 | | - |
66 | | - |
67 | | - exec("/etc/init.d/mysql stop"); |
68 | | - exec("rm -rf /var/lib/mysql/".$conf["db_database"]); |
69 | | - exec("/etc/init.d/mysql start"); |
70 | | - |
71 | | - // Deleting the symlink in /var/www |
72 | | - // Apache |
73 | | - @unlink("/etc/apache2/sites-enabled/000-ispconfig.vhost"); |
74 | | - @unlink("/etc/apache2/sites-available/ispconfig.vhost"); |
75 | | - @unlink("/etc/apache2/sites-enabled/000-apps.vhost"); |
76 | | - @unlink("/etc/apache2/sites-available/apps.vhost"); |
77 | | - |
78 | | - // nginx |
79 | | - @unlink("/etc/nginx/sites-enabled/000-ispconfig.vhost"); |
80 | | - @unlink("/etc/nginx/sites-available/ispconfig.vhost"); |
81 | | - @unlink("/etc/nginx/sites-enabled/000-apps.vhost"); |
82 | | - @unlink("/etc/nginx/sites-available/apps.vhost"); |
83 | | - |
84 | | - // Delete the ispconfig files |
85 | | - exec('rm -rf /usr/local/ispconfig'); |
86 | | - |
87 | | - echo "Please do not forget to delete the ispconfig user in the mysql.user table.\n\n"; |
88 | | - echo "Finished uninstalling.\n"; |
| 85 | +//echo "Please do not forget to delete the ispconfig user in the mysql.user table.\n\n"; |
89 | 86 |
|
90 | | -} else { |
91 | | - echo "\n\n>> Canceled uninstall. \n\n"; |
92 | | -} |
| 87 | +echo "Finished.\n"; |
93 | 88 |
|
94 | 89 | ?> |
0 commit comments