Commit edcc9406 authored by redray's avatar redray
Browse files

crop db user if longer than 16 chars (mysql limit)

parent df22a818
...@@ -251,8 +251,9 @@ class page_action extends tform_actions { ...@@ -251,8 +251,9 @@ class page_action extends tform_actions {
if ($app->tform->errorMessage == ''){ if ($app->tform->errorMessage == ''){
/* restrict the names if there is no error */ /* restrict the names if there is no error */
$this->dataRecord['database_name'] = $dbname_prefix . $this->dataRecord['database_name']; /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
$this->dataRecord['database_user'] = $dbuser_prefix . $this->dataRecord['database_user']; $this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
} }
parent::onBeforeUpdate(); parent::onBeforeUpdate();
...@@ -268,8 +269,9 @@ class page_action extends tform_actions { ...@@ -268,8 +269,9 @@ class page_action extends tform_actions {
$dbuser_prefix = replacePrefix($global_config['dbuser_prefix'], $this->dataRecord); $dbuser_prefix = replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
/* restrict the names */ /* restrict the names */
$this->dataRecord['database_name'] = $dbname_prefix . $this->dataRecord['database_name']; /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
$this->dataRecord['database_user'] = $dbuser_prefix . $this->dataRecord['database_user']; $this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
parent::onBeforeInsert(); 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