| [ PHPXref.com ] | [ Generated: Sun Jul 20 18:16:01 2008 ] | [ ISPConfig 2.2.1 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 #!/root/ispconfig/php/php -q 2 <? 3 /* 4 Copyright (c) 2005, projektfarm Gmbh, Till Brehm, Falko Timme 5 All rights reserved. 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 set_time_limit(0); 31 32 include("/root/ispconfig/scripts/lib/config.inc.php"); 33 include("/root/ispconfig/scripts/lib/server.inc.php"); 34 35 function getInput($length = 255) { 36 $fr = fopen("php://stdin", "r"); 37 $input = fgets($fr, $length); 38 $input = rtrim($input); 39 fclose($fr); 40 return $input; 41 } 42 43 echo "You chose to uninstall the ISPConfig system! Do you also want to uninstall the objects (webs, users, databases, DNS entries etc.) created by the system? [y/n] "; 44 $answer = getInput(); 45 46 $db_server = $go_info["server"]["db_host"]; 47 $db_user = $go_info["server"]["db_user"]; 48 $db_password = $go_info["server"]["db_password"]; 49 $db = $go_info["server"]["db_name"]; 50 $httpd_conf = $mod->system->server_conf["dist_httpd_conf"]; 51 /* 52 if($answer == "y"){ 53 $link = @mysql_connect($db_server, $db_user, $db_password) 54 or die("Could not connect to MySQL server!"); 55 mysql_select_db($db); 56 mysql_query("UPDATE dns_isp_dns SET status = 'd'"); 57 mysql_query("UPDATE isp_isp_datenbank SET status = 'd'"); 58 mysql_query("UPDATE isp_isp_domain SET status = 'd'"); 59 mysql_query("UPDATE isp_isp_user SET status = 'd'"); 60 mysql_query("UPDATE isp_isp_web SET status = 'd'"); 61 mysql_query("UPDATE dns_nodes SET status = '0'"); 62 mysql_query("UPDATE isp_nodes SET status = '0'"); 63 mysql_close($link); 64 exec("/root/ispconfig/php/php -q /root/ispconfig/scripts/writeconf.php &> /dev/null"); 65 } 66 */ 67 $replace = "<Directory /var/www/sharedip> 68 Options +Includes -Indexes 69 AllowOverride None 70 AllowOverride Indexes AuthConfig Limit FileInfo 71 Order allow,deny 72 Allow from all 73 <Files ~ \"^\\.ht\"> 74 Deny from all 75 </Files> 76 </Directory> 77 78 ###############ispconfig_log############### 79 LogFormat \"%v||||%b||||%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"\" combined_ispconfig 80 CustomLog \"|/root/ispconfig/cronolog --symlink=/var/log/httpd/ispconfig_access_log /var/log/httpd/ispconfig_access_log_%Y_%m_%d\" combined_ispconfig 81 82 <Directory ".$mod->system->server_conf["server_path_httpd_root"]."/*/web> 83 Options +Includes -Indexes 84 AllowOverride None 85 AllowOverride Indexes AuthConfig Limit FileInfo 86 Order allow,deny 87 Allow from all 88 <Files ~ \"^\\.ht\"> 89 Deny from all 90 </Files> 91 </Directory> 92 93 <Directory ".$mod->system->server_conf["server_path_httpd_root"]."/*/user/*/web> 94 Options +Includes -Indexes 95 AllowOverride None 96 AllowOverride Indexes AuthConfig Limit FileInfo 97 Order allow,deny 98 Allow from all 99 <Files ~ \"^\\.ht\"> 100 Deny from all 101 </Files> 102 </Directory> 103 104 <Directory ".$mod->system->server_conf["server_path_httpd_root"]."/*/cgi-bin> 105 Options ExecCGI -Indexes 106 AllowOverride None 107 AllowOverride Indexes AuthConfig Limit FileInfo 108 Order allow,deny 109 Allow from all 110 <Files ~ \"^\\.ht\"> 111 Deny from all 112 </Files> 113 </Directory> 114 115 Include ".$mod->system->server_conf["server_path_httpd_conf"]."/vhosts/Vhosts_ispconfig.conf"; 116 117 $fp = fopen ($httpd_conf, "r"); 118 $conf = fread($fp, filesize ($httpd_conf)); 119 fclose($fp); 120 $conf = str_replace($replace, "", $conf); 121 $fp = fopen ($httpd_conf, "w"); 122 fwrite($fp,$conf); 123 fclose($fp); 124 125 exec("apachectl restart &> /dev/null"); 126 exec("apache2ctl restart &> /dev/null"); 127 128 if($mod->system->server_conf["server_ftp_typ"] == "proftpd"){ 129 $fp = fopen ($mod->system->server_conf["server_proftpd_conf_datei"], "r"); 130 $conf = fread($fp, filesize ($mod->system->server_conf["server_proftpd_conf_datei"])); 131 fclose($fp); 132 $conf = str_replace("Include /etc/proftpd_ispconfig.conf", "", $conf); 133 $fp = fopen ($mod->system->server_conf["server_proftpd_conf_datei"], "w"); 134 fwrite($fp,$conf); 135 fclose($fp); 136 if($mod->system->server_conf["dist_ftp_version"] == "standalone"){ 137 $mod->system->daemon_init($mod->system->server_conf["server_ftp_typ"], "restart"); 138 } else { 139 $mod->system->daemon_init($mod->system->server_conf["dist_ftp_version"], "restart"); 140 } 141 } 142 if($mod->system->server_conf["server_ftp_typ"] == "vsftpd"){ 143 if(is_file($mod->system->server_conf["dist_init_scripts"]."/ispconfig_tcpserver")){ 144 $mod->system->daemon_init("ispconfig_tcpserver", "stop"); 145 unlink($mod->system->server_conf["dist_init_scripts"]."/ispconfig_tcpserver"); 146 } 147 $mod->system->rc_edit("ispconfig_tcpserver", "2,3,5", "off"); 148 //if($mod->system->server_conf["dist_ftp_version"] == "inetd"){ 149 // exec("mv -f /etc/inetd.conf.backup /etc/inetd.conf &> /dev/null"); 150 // exec($mod->system->server_conf["dist_init_scripts"]."/inetd restart"); 151 //} 152 //if($mod->system->server_conf["dist_ftp_version"] == "xinetd"){ 153 // exec("mv -f /etc/vsftpd_xinetd.backup /etc/xinetd.d/vsftpd &> /dev/null"); 154 // exec($mod->system->server_conf["dist_init_scripts"]."/xinetd restart"); 155 //} 156 exec("rm -f /etc/vsftpd_*.conf"); 157 } 158 159 $cron_jobs = array('30 00 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php &> /dev/null','59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/ftp_logs.php &> /dev/null','59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/mail_logs.php &> /dev/null','59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/cleanup.php &> /dev/null','0 4 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/webalizer.php &> /dev/null','0,30 * * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/check_services.php &> /dev/null','15 3,15 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/quota_msg.php &> /dev/null','40 00 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/traffic.php &> /dev/null','05 02 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/backup.php &> /dev/null'); 160 161 if($mod->system->server_conf["dist_cron_daemon"] == "fcron"){ 162 //$cron_tsl_unfile = "/home/unfcronisp"; 163 exec("/usr/bin/fcrontab -l > /home/unfcronisp"); 164 exec("chmod 777 /home/unfcronisp"); 165 $fptsl = fopen ("/home/unfcronisp", "r"); 166 $conftsl = fread($fptsl, filesize ("/home/unfcronisp")); 167 fclose($fptsl); 168 foreach($cron_jobs as $cron_job){ 169 $conftsl = str_replace($cron_job, "", $conftsl); 170 } 171 $fptsl= fopen ("/home/unfcronisp", "w"); 172 fwrite($fptsl,$conftsl); 173 fclose($fptsl); 174 $mod->file->remove_blank_lines("/home/unfcronisp"); 175 exec("/usr/bin/fcrontab /home/unfcronisp"); 176 exec("rm -f /home/unfcronisp"); 177 } else { 178 $fp = fopen ($mod->system->server_conf["dist_cron_tab"], "r"); 179 $conf = fread($fp, filesize ($mod->system->server_conf["dist_cron_tab"])); 180 fclose($fp); 181 foreach($cron_jobs as $cron_job){ 182 $conf = str_replace($cron_job, "", $conf); 183 } 184 $fp = fopen ($mod->system->server_conf["dist_cron_tab"], "w"); 185 fwrite($fp,$conf); 186 fclose($fp); 187 $mod->file->remove_blank_lines($mod->system->server_conf["dist_cron_tab"]); 188 } 189 $mod->system->daemon_init($mod->system->server_conf["dist_cron_daemon"], "restart"); 190 191 $link = mysql_connect($db_server, $db_user, $db_password) 192 or die("Could not connect"); 193 echo "Connected successfully\n"; 194 mysql_query("DROP DATABASE ".$db); 195 196 $mod->system->daemon_init("ispconfig_server", "stop"); 197 $mod->system->deluser("admispconfig"); 198 $mod->system->delgroup("admispconfig"); 199 if(is_file("/var/spool/mail/admispconfig")){ 200 unlink("/var/spool/mail/admispconfig"); 201 } 202 $mod->system->rc_edit("ispconfig_server", "2,3,5", "off"); 203 unlink($mod->system->server_conf["dist_init_scripts"]."/ispconfig_server"); 204 205 exec("rm -fr /home/admispconfig"); 206 exec("rm -fr /root/ispconfig"); 207 208 ///////// Töten aller laufenden ispconfig-Prozesse //////////// 209 function nicht_leer($var) { 210 return ($var != ""); 211 } 212 213 exec("ps ax | grep ispconfig | grep -v uninstall", $results); 214 215 foreach($results as $result){ 216 $values = explode(" ", $result); 217 $werte = array_filter($values, "nicht_leer"); 218 foreach($werte as $wert){ 219 $arr[] = $wert; 220 } 221 222 exec("kill -9 ".$arr[0]." &> /dev/null"); 223 unset($arr); 224 } 225 ////////////////////////////////////////////////////// 226 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |