mcramer
2013-05-17 6508d0c5b766fe56e96741a61ab7a1ece4191f2d
- Possible Fix for:  FS#2918 - multiserver - remote access db passwd not changed , when changed access from IP to % and vice versa 

3 files modified
11 ■■■■ changed files
interface/web/sites/database_user_del.php 7 ●●●● patch | view | raw | blame | history
interface/web/sites/database_user_edit.php 2 ●●● patch | view | raw | blame | history
server/plugins-available/mysql_clientdb_plugin.inc.php 2 ●●●●● patch | view | raw | blame | history
interface/web/sites/database_user_del.php
@@ -53,7 +53,12 @@
        if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
        
        $old_record = $app->tform->getDataRecord($this->id);
        $app->db->datalogDelete('web_database_user', 'database_user_id', $this->id);
        /* we cannot use datalogDelete here, as we need to set server_id to 0 */
        $this->query("DELETE FROM `web_database_user` WHERE $index_field = '$index_value'");
        $new_rec = array();
        $old_record['server_id'] = 0;
        $this->datalogSave('web_database_user', 'DELETE', 'database_user_id', $this->id, $old_record, $new_rec);
    }
    
    function onAfterDelete() { // this has to be done on AFTER delete, because we need the db user still in the database when the server plugin processes the datalog
interface/web/sites/database_user_edit.php
@@ -147,7 +147,7 @@
            $this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
        }
        
        $this->dataRecord['server_id'] = $conf['server_id'];
        $this->dataRecord['server_id'] = 0;
        
        parent::onBeforeUpdate();
    }
server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -503,6 +503,8 @@
        $host_list = array('localhost');
        // get all databases this user was active for
        $db_list = $app->db->queryAllRecords("SELECT `remote_access`, `remote_ips` FROM `web_database` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
        if(count($db_list) < 1) return; // nothing to do on this server for this db user
        foreach($db_list as $database) {
            if($database['remote_access'] != 'y') continue;