@@ -7,14 +7,15 @@ class SqlParser {
77 var $ conn , $ installFailed , $ sitename , $ adminname , $ adminemail , $ adminpass , $ managerlanguage ;
88 var $ mode , $ fileManagerPath , $ imgPath , $ imgUrl ;
99 var $ connection_charset , $ connection_method ;
10+ public $ database_collation ;
1011
1112 public function __construct () {
1213 $ adminname ='' ;
13- $ adminemail ='' ;
14- $ adminpass ='' ;
15- $ connection_charset = 'utf8 ' ;
16- $ managerlanguage ='english ' ;
17- $ connection_method = 'SET CHARACTER SET ' ;
14+ $ adminemail ='' ;
15+ $ adminpass ='' ;
16+ $ connection_charset = 'utf8 ' ;
17+ $ managerlanguage ='english ' ;
18+ $ connection_method = 'SET CHARACTER SET ' ;
1819 $ auto_template_logic = 'parent ' ;
1920 $ this ->adminname = $ adminname ;
2021 $ this ->adminemail = $ adminemail ;
@@ -27,7 +28,7 @@ public function __construct() {
2728
2829 function process ($ filename ) {
2930 global $ modx_version ,$ modx ;
30-
31+
3132 // check to make sure file exists
3233 if (!file_exists ($ filename )) {
3334 $ this ->mysqlErrors [] = array ("error " => "File ' $ filename' not found " );
@@ -53,6 +54,7 @@ function process($filename) {
5354
5455 // replace {} tags
5556 $ idata = str_replace ('{PREFIX} ' , $ modx ->db ->config ['table_prefix ' ], $ idata );
57+ $ idata = str_replace ('{TABLEENCODING} ' , $ this ->getTableEncoding (), $ idata );
5658 $ idata = str_replace ('{ADMIN} ' , $ this ->adminname , $ idata );
5759 $ idata = str_replace ('{ADMINEMAIL} ' , $ this ->adminemail , $ idata );
5860 $ idata = str_replace ('{ADMINPASS} ' , $ this ->adminpass , $ idata );
@@ -82,9 +84,17 @@ function process($filename) {
8284 $ num = $ num + 1 ;
8385 if ($ sql_do ) $ modx ->db ->query ($ sql_do , false );
8486 }
85-
86-
87+
88+
8789 }
88- }
8990
90- ?>
91+ public function getTableEncoding ()
92+ {
93+ $ out = 'DEFAULT CHARSET= ' . $ this ->connection_charset ;
94+ if (!empty ($ this ->database_collation )) {
95+ $ out .= ' COLLATE= ' . $ this ->database_collation ;
96+ }
97+
98+ return $ out ;
99+ }
100+ }
0 commit comments