Skip to content

Commit 5b5f7c5

Browse files
author
Marius Cramer
committed
Merge branch 'master' of /home/git/repositories/florian030/ispconfig3
2 parents bd8b728 + c1245b5 commit 5b5f7c5

File tree

4 files changed

+83
-42
lines changed

4 files changed

+83
-42
lines changed

install/uninstall-fedora.php

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434

3535
error_reporting(E_ALL|E_STRICT);
3636

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+
3741
//** The banner on the command line
3842
echo "\n\n".str_repeat('-', 80)."\n";
3943
echo " _____ ___________ _____ __ _ ____
@@ -47,36 +51,52 @@
4751
echo "\n".str_repeat('-', 80)."\n";
4852
echo "\n\n>> Uninstall \n\n";
4953

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+
}
81101

82102
?>

install/uninstall.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
require_once "/usr/local/ispconfig/server/lib/config.inc.php";
3838
require_once "/usr/local/ispconfig/server/lib/app.inc.php";
39+
require "/usr/local/ispconfig/server/mysql_clientdb.conf";
3940

4041
//** The banner on the command line
4142
echo "\n\n".str_repeat('-', 80)."\n";
@@ -63,10 +64,20 @@
6364
// $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
6465
// $app->db->query("DELETE FROM mysql.user WHERE User = 'ispconfig'");
6566

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");
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+
$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);
7081

7182
// Deleting the symlink in /var/www
7283
// Apache
@@ -84,7 +95,7 @@
8495
// Delete the ispconfig files
8596
exec('rm -rf /usr/local/ispconfig');
8697

87-
echo "Please do not forget to delete the ispconfig user in the mysql.user table.\n\n";
98+
// echo "Please do not forget to delete the ispconfig user in the mysql.user table.\n\n";
8899
echo "Finished uninstalling.\n";
89100

90101
} else {

interface/web/mail/mail_domain_dkim_create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function get_public_key($private_key) {
9595
exec('openssl rand -out /usr/local/ispconfig/server/temp/random-data.bin 4096', $output, $result);
9696
exec('openssl genrsa -rand /usr/local/ispconfig/server/temp/random-data.bin 1024', $privkey, $result);
9797
unlink("/usr/local/ispconfig/server/temp/random-data.bin");
98-
$private_key='';
98+
foreach($privkey as $values) $private_key=$private_key.$values."\n";
9999
break;
100100

101101
case 'show': /* show the DNS-Record onLoad */

server/plugins-available/mail_plugin_dkim.inc.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ function get_amavis_config() {
7777
$pos_config=array(
7878
'/etc/amavisd.conf',
7979
'/etc/amavisd.conf/50-user',
80-
'/etc/amavis/conf.d/50-user'
80+
'/etc/amavis/conf.d/50-user',
81+
'/etc/amavisd/amavisd.conf'
8182
);
8283
$amavis_configfile='';
8384
foreach($pos_config as $conf) {
@@ -123,13 +124,22 @@ function check_system($data) {
123124
*/
124125
function restart_amavis() {
125126
global $app, $conf;
126-
$initfile=$conf['init_scripts'].'/amavis';
127-
$app->log('Restarting amavis.', LOGLEVEL_DEBUG);
128-
exec(escapeshellarg($conf['init_scripts']).escapeshellarg('/amavis').' restart', $output);
127+
$pos_init=array(
128+
$conf['init_scripts'].'/amavis',
129+
$conf['init_scripts'].'/amavisd'
130+
);
131+
$initfile='';
132+
foreach($pos_init as $init) {
133+
if (is_executable($init)) {
134+
$initfile=$init;
135+
break;
136+
}
137+
}
138+
$app->log('Restarting amavis: '.$initfile.'.', LOGLEVEL_DEBUG);
139+
exec(escapeshellarg($initfile).' restart', $output);
129140
foreach($output as $logline) $app->log($logline, LOGLEVEL_DEBUG);
130141
}
131142

132-
133143
/**
134144
* This function writes the keyfiles (public and private)
135145
* @param string $key_file full path to the key-file

0 commit comments

Comments
 (0)