From 3dded7b96c519efe9a5015f09712462164d1888f Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Mon, 15 Feb 2016 02:39:24 -0500
Subject: [PATCH] removed useless FLUSH PRIVILEGES

---
 server/plugins-available/mysql_clientdb_plugin.inc.php  |    7 -------
 install/lib/installer_base.lib.php                      |   15 ++-------------
 install/dist/lib/gentoo.lib.php                         |    3 ---
 install/update.php                                      |    6 +++---
 server/plugins-available/software_update_plugin.inc.php |    1 -
 5 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index 4080bed..b457474 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -472,9 +472,6 @@
 			$this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage);
 		}
 
-		//* Reload database privelages
-		$this->db->query('FLUSH PRIVILEGES;');
-
 		//* load the powerdns databse dump
 		if($conf['mysql']['admin_password'] == '') {
 			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index f2b7041..e7a664d 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -263,18 +263,14 @@
 		}
 
 		// Delete ISPConfig user in the local database, in case that it exists
-		$this->db->query("DELETE FROM mysql.user WHERE User = ? AND Host = ?", $conf['mysql']['ispconfig_user'], $from_host);
-		$this->db->query("DELETE FROM mysql.db WHERE Db = ? AND Host = ?", $conf['mysql']['database'], $from_host);
-		$this->db->query('FLUSH PRIVILEGES');
+		$this->db->query("DROP USER ?'@'? ", $conf['mysql']['ispconfig_user'], $from_host);
+		$this->db->query("DROP DATABASE IF EXISTS ?", $conf['mysql']['database']);
 
 		//* Create the ISPConfig database user in the local database
 		$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON ?? TO ?@? IDENTIFIED BY ?';
 		if(!$this->db->query($query, $conf['mysql']['database'] . ".*", $conf['mysql']['ispconfig_user'], $from_host, $conf['mysql']['ispconfig_password'])) {
 			$this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage);
 		}
-
-		//* Reload database privelages
-		$this->db->query('FLUSH PRIVILEGES;');
 
 		//* Set the database name in the DB library
 		$this->db->setDBName($conf['mysql']['database']);
@@ -655,10 +651,6 @@
 				}
 			}
 
-			/*
-		 * It is all done. Relod the rights...
-		 */
-			$this->dbmaster->query('FLUSH PRIVILEGES');
 		}
 
 	}
@@ -1471,9 +1463,6 @@
 		if(!$this->db->query($query, $conf['powerdns']['database'] . '.*', $conf['mysql']['ispconfig_user'])) {
 			$this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage);
 		}
-
-		//* Reload database privelages
-		$this->db->query('FLUSH PRIVILEGES');
 
 		//* load the powerdns databse dump
 		if($conf['mysql']['admin_password'] == '') {
diff --git a/install/update.php b/install/update.php
index fe08903..8f818df 100644
--- a/install/update.php
+++ b/install/update.php
@@ -326,9 +326,9 @@
 			$inst->configure_postfix('dont-create-certs');
 
 			if($conf['dovecot']['installed'] == true) {
-			//* Configure dovecot
-			swriteln('Configuring Dovecot');
-			$inst->configure_dovecot();
+				//* Configure dovecot
+				swriteln('Configuring Dovecot');
+				$inst->configure_dovecot();
 			} elseif ($conf['courier']['installed'] == true) {
 				//** Configure saslauthd
 				swriteln('Configuring SASL');
diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index 7a5128a..743d27a 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -228,7 +228,6 @@
 
 			}
 
-			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
 	}
@@ -433,7 +432,6 @@
 						}
 					}
 					// Database is not active, so stop processing here
-					$link->query('FLUSH PRIVILEGES;');
 					$link->close();
 					return;
 				}
@@ -570,8 +568,6 @@
 				}
 			}
 
-
-			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
 
@@ -621,7 +617,6 @@
 				$app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error, LOGLEVEL_WARNING);
 			}
 
-			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
 
@@ -685,7 +680,6 @@
 			}
 		}
 
-		$link->query('FLUSH PRIVILEGES;');
 		$link->close();
 
 	}
@@ -721,7 +715,6 @@
 			}
 		}
 
-		$link->query('FLUSH PRIVILEGES;');
 		$link->close();
 	}
 
diff --git a/server/plugins-available/software_update_plugin.inc.php b/server/plugins-available/software_update_plugin.inc.php
index 83fb831..640d7a9 100644
--- a/server/plugins-available/software_update_plugin.inc.php
+++ b/server/plugins-available/software_update_plugin.inc.php
@@ -267,7 +267,6 @@
 				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysqli_error($link), LOGLEVEL_ERROR);
 			}
 
-			mysqli_query($link, "FLUSH PRIVILEGES;");
 			mysqli_close($link);
 
 		}

--
Gitblit v1.9.1