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