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