Pascal Dreissen
2016-07-08 505fc4feb44bf9606f6ecc1f7bae897cf61446a3
commit | author | age
ba747c 1 <?php
T 2
3 /*
00dfba 4 Copyright (c) 2007, Till Brehm, projektfarm Gmbh
ba747c 5 All rights reserved.
T 6
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9
10     * Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12     * Redistributions in binary form must reproduce the above copyright notice,
13       this list of conditions and the following disclaimer in the documentation
14       and/or other materials provided with the distribution.
15     * Neither the name of ISPConfig nor the names of its contributors
16       may be used to endorse or promote products derived from this software without
17       specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
00dfba 31 /*
R 32     ISPConfig 3 uninstaller.
33 */
34
35 error_reporting(E_ALL|E_STRICT);
36
c1245b 37 require_once "/usr/local/ispconfig/server/lib/config.inc.php";
FS 38 require_once "/usr/local/ispconfig/server/lib/app.inc.php";
c51b57 39 require "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
c1245b 40
00dfba 41 //** The banner on the command line
b1a6a5 42 echo "\n\n".str_repeat('-', 80)."\n";
4602a7 43 echo " _____ ___________   _____              __ _         ____
V 44 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
45   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
46   | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |  |_ |
47  _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| | ___\ \
48  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
00dfba 49                                               __/ |
R 50                                              |___/ ";
b1a6a5 51 echo "\n".str_repeat('-', 80)."\n";
00dfba 52 echo "\n\n>> Uninstall  \n\n";
R 53
c51b57 54 echo "Are you sure you want to uninstall ISPConfig? [no]";
c1245b 55 $input = fgets(STDIN);
FS 56 $do_uninstall = rtrim($input);
92aea2 57
c1245b 58
FS 59 if($do_uninstall == 'yes') {
60
61     echo "\n\n>> Uninstalling ISPConfig 3... \n\n";
62
f1926a 63     $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
c1245b 64     if (!$link) {
c51b57 65         echo "Unable to connect to the database. mysql_error($link)";
c1245b 66     } else {
c51b57 67         $result=mysqli_query($link,"DROP DATABASE ".$conf['db_database'].";");
f1926a 68         if (!$result) echo "Unable to remove the ispconfig-database ".$conf['db_database']." ".mysqli_error($link)."\n";
c51b57 69         $result=mysqli_query($link,"DROP USER '".$conf['db_user']."'@'".$conf['db_host']."';");
f1926a 70             if (!$result) echo "Unable to remove the ispconfig-database-user ".$conf['db_user']." ".mysqli_error($link)."\n";
c1245b 71     }
f1926a 72     mysqli_close($link);
c1245b 73     
FS 74     // Deleting the symlink in /var/www
75     // Apache
76     @unlink("/etc/apache2/sites-enabled/000-ispconfig.vhost");
77     @unlink("/etc/apache2/sites-available/ispconfig.vhost");
78     @unlink("/etc/apache2/sites-enabled/000-apps.vhost");
79     @unlink("/etc/apache2/sites-available/apps.vhost");
80     
81     // nginx
82     @unlink("/etc/nginx/sites-enabled/000-ispconfig.vhost");
83     @unlink("/etc/nginx/sites-available/ispconfig.vhost");
84     @unlink("/etc/nginx/sites-enabled/000-apps.vhost");
85     @unlink("/etc/nginx/sites-available/apps.vhost");
86     
87     // Delete the ispconfig files
88     exec('rm -rf /usr/local/ispconfig');
89     
ebbe63 90     // Delete various other files
MC 91     @unlink("/usr/local/bin/ispconfig_update.sh");
92     @unlink("/usr/local/bin/ispconfig_update_from_svn.sh");
93     @unlink("/var/spool/mail/ispconfig");
94     @unlink("/var/www/ispconfig");
95     @unlink("/var/www/php-fcgi-scripts/ispconfig");
96     @unlink("/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter");
97     
98     echo "Backups in /var/backup/ and log files in /var/log/ispconfig are not deleted.";
c1245b 99     echo "Finished uninstalling.\n";
FS 100
c63b39 101 } else {
c1245b 102     echo "\n\n>> Canceled uninstall. \n\n";
ec70dd 103 }
ba747c 104
8896ab 105 ?>