Commit 4b7584c6 authored by Marius Cramer's avatar Marius Cramer
Browse files

Fixed issue with non-existing database user on slave server

parent c3d8a845
......@@ -275,7 +275,26 @@ class page_action extends tform_actions {
}
}
}
if ($app->tform->errorMessage == '') {
// force update of the used database user
if($this->dataRecord['database_user_id']) {
$user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_user_id']));
if($user_old_rec) {
$user_new_rec = $user_old_rec;
$user_new_rec['server_id'] = $this->dataRecord['server_id'];
$app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_user_id'], $user_old_rec, $user_new_rec);
}
}
if($this->dataRecord['database_ro_user_id']) {
$user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_ro_user_id']));
if($user_old_rec) {
$user_new_rec = $user_old_rec;
$user_new_rec['server_id'] = $this->dataRecord['server_id'];
$app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_ro_user_id'], $user_old_rec, $user_new_rec);
}
}
}
parent::onBeforeUpdate();
}
......@@ -344,6 +363,27 @@ class page_action extends tform_actions {
}
}
if ($app->tform->errorMessage == '') {
// force update of the used database user
if($this->dataRecord['database_user_id']) {
$user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_user_id']));
if($user_old_rec) {
$user_new_rec = $user_old_rec;
$user_new_rec['server_id'] = $this->dataRecord['server_id'];
$app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_user_id'], $user_old_rec, $user_new_rec);
}
}
if($this->dataRecord['database_ro_user_id']) {
$user_old_rec = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user_id` = ' . $app->functions->intval($this->dataRecord['database_ro_user_id']));
if($user_old_rec) {
$user_new_rec = $user_old_rec;
$user_new_rec['server_id'] = $this->dataRecord['server_id'];
$app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->dataRecord['database_ro_user_id'], $user_old_rec, $user_new_rec);
}
}
}
parent::onBeforeInsert();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment