@@ -235,21 +235,27 @@ public function reconfigure_app($service, $reconfigure_services_answer) {
235235 public function configure_database () {
236236 global $ conf ;
237237
238- //* check sql-mode
239- /*$check_sql_mode = $this->db->queryOneRecord("SELECT @@sql_mode");
240-
241- if ($check_sql_mode['@@sql_mode'] != '' && $check_sql_mode['@@sql_mode'] != 'NO_ENGINE_SUBSTITUTION') {
242- echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n";
243- echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n";
244- echo"to the mysqld-section in your mysql-config on this server and restart mysqld afterwards\n";
245- die();
246- }*/
247-
248- $ unwanted_sql_plugins = array ('validate_password ' );
249- $ sql_plugins = $ this ->db ->queryAllRecords ("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ? " , $ unwanted_sql_plugins );
250- if (is_array ($ sql_plugins ) && !empty ($ sql_plugins )) {
251- foreach ($ sql_plugins as $ plugin ) echo "Login in to MySQL and disable $ plugin [plugin_name] with: \n\n UNINSTALL PLUGIN $ plugin [plugin_name]; " ;
252- die ();
238+ //** Check for unwanted plugins
239+ if ($ this ->db ->getDatabaseType () == 'mysql ' && $ this ->db ->getDatabaseVersion (true ) >= 8 ) {
240+ // component approach since MySQL 8.0
241+ $ unwanted_components = [
242+ 'file://component_validate_password ' ,
243+ ];
244+ $ sql_components = $ this ->db ->queryAllRecords ("SELECT * FROM mysql.component where component_urn IN ? " , $ unwanted_components );
245+ if (is_array ($ sql_components ) && !empty ($ sql_components )) {
246+ foreach ($ sql_components as $ component ) {
247+ $ component_name = parse_url ($ component ['component_urn ' ], PHP_URL_HOST );
248+ echo "Login in to MySQL and disable ' {$ component_name }' with: \n\n UNINSTALL COMPONENT ' {$ component ['component_urn ' ]}'; \n\n" ;
249+ }
250+ die ();
251+ }
252+ } else {
253+ $ unwanted_sql_plugins = array ('validate_password ' );
254+ $ sql_plugins = $ this ->db ->queryAllRecords ("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ? " , $ unwanted_sql_plugins );
255+ if (is_array ($ sql_plugins ) && !empty ($ sql_plugins )) {
256+ foreach ($ sql_plugins as $ plugin ) echo "Login in to MySQL and disable $ plugin [plugin_name] with: \n\n UNINSTALL PLUGIN $ plugin [plugin_name]; " ;
257+ die ();
258+ }
253259 }
254260
255261 //** Create the database
@@ -308,6 +314,15 @@ public function add_database_server_record() {
308314 if (!$ this ->db ->query ($ query , $ conf ['mysql ' ]['database ' ] . ".* " , $ conf ['mysql ' ]['ispconfig_user ' ], $ from_host )) {
309315 $ this ->error ('Unable to grant databse permissions to user: ' .$ conf ['mysql ' ]['ispconfig_user ' ].' Error: ' .$ this ->db ->errorMessage );
310316 }
317+
318+ // add correct administrative rights to IPSConfig user (SUPER is deprecated and unnecessarily powerful)
319+ if ($ this ->db ->getDatabaseType () == 'mysql ' && $ this ->db ->getDatabaseVersion (true ) >= 8 ) {
320+ // there might be more needed on replicated db environments, this was not tested
321+ $ query = 'GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO ?@? ' ;
322+ if (!$ this ->db ->query ($ query , $ conf ['mysql ' ]['ispconfig_user ' ], $ from_host )) {
323+ $ this ->error ('Unable to grant administrative permissions to user: ' .$ conf ['mysql ' ]['ispconfig_user ' ].' Error: ' .$ this ->db ->errorMessage );
324+ }
325+ }
311326
312327 //* Set the database name in the DB library
313328 $ this ->db ->setDBName ($ conf ['mysql ' ]['database ' ]);
0 commit comments