File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -251,8 +251,9 @@ function onBeforeUpdate() {
251251
252252 if ($ app ->tform ->errorMessage == '' ){
253253 /* restrict the names if there is no error */
254- $ this ->dataRecord ['database_name ' ] = $ dbname_prefix . $ this ->dataRecord ['database_name ' ];
255- $ this ->dataRecord ['database_user ' ] = $ dbuser_prefix . $ this ->dataRecord ['database_user ' ];
254+ /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
255+ $ this ->dataRecord ['database_name ' ] = substr ($ dbname_prefix . $ this ->dataRecord ['database_name ' ], 0 , 64 );
256+ $ this ->dataRecord ['database_user ' ] = substr ($ dbuser_prefix . $ this ->dataRecord ['database_user ' ], 0 , 16 );
256257 }
257258
258259 parent ::onBeforeUpdate ();
@@ -268,8 +269,9 @@ function onBeforeInsert() {
268269 $ dbuser_prefix = replacePrefix ($ global_config ['dbuser_prefix ' ], $ this ->dataRecord );
269270
270271 /* restrict the names */
271- $ this ->dataRecord ['database_name ' ] = $ dbname_prefix . $ this ->dataRecord ['database_name ' ];
272- $ this ->dataRecord ['database_user ' ] = $ dbuser_prefix . $ this ->dataRecord ['database_user ' ];
272+ /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
273+ $ this ->dataRecord ['database_name ' ] = substr ($ dbname_prefix . $ this ->dataRecord ['database_name ' ], 0 , 64 );
274+ $ this ->dataRecord ['database_user ' ] = substr ($ dbuser_prefix . $ this ->dataRecord ['database_user ' ], 0 , 16 );
273275
274276 parent ::onBeforeInsert ();
275277 }
You can’t perform that action at this time.
0 commit comments