@@ -235,17 +235,26 @@ 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");
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+ }
240252
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- }*/
253+ $ unwanted_sql_plugins = ['' ];
254+ } else {
255+ $ unwanted_sql_plugins = array ('validate_password ' );
256+ }
247257
248- $ unwanted_sql_plugins = array ('validate_password ' );
249258 $ sql_plugins = $ this ->db ->queryAllRecords ("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ? " , $ unwanted_sql_plugins );
250259 if (is_array ($ sql_plugins ) && !empty ($ sql_plugins )) {
251260 foreach ($ sql_plugins as $ plugin ) echo "Login in to MySQL and disable $ plugin [plugin_name] with: \n\n UNINSTALL PLUGIN $ plugin [plugin_name]; " ;
@@ -308,6 +317,15 @@ public function add_database_server_record() {
308317 if (!$ this ->db ->query ($ query , $ conf ['mysql ' ]['database ' ] . ".* " , $ conf ['mysql ' ]['ispconfig_user ' ], $ from_host )) {
309318 $ this ->error ('Unable to grant databse permissions to user: ' .$ conf ['mysql ' ]['ispconfig_user ' ].' Error: ' .$ this ->db ->errorMessage );
310319 }
320+
321+ // add correct administrative rights to IPSConfig user (SUPER is deprecated and unnecessarily powerful)
322+ if ($ this ->db ->getDatabaseType () == 'mysql ' && $ this ->db ->getDatabaseVersion (true ) >= 8 ) {
323+ // there might be more needed on replicated db environments, this was not tested
324+ $ query = 'GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO ?@? ' ;
325+ if (!$ this ->db ->query ($ query , $ conf ['mysql ' ]['ispconfig_user ' ], $ from_host )) {
326+ $ this ->error ('Unable to grant administrative permissions to user: ' .$ conf ['mysql ' ]['ispconfig_user ' ].' Error: ' .$ this ->db ->errorMessage );
327+ }
328+ }
311329
312330 //* Set the database name in the DB library
313331 $ this ->db ->setDBName ($ conf ['mysql ' ]['database ' ]);
0 commit comments