- Timestamp:
- May 19, 2019 10:51:34 PM (5 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r679 r683 124 124 'user_timezone' => 'UTC', 125 125 'php_timezone' => 'UTC', 126 ' mysql_timezone' => 'UTC',126 'db_timezone' => 'UTC', 127 127 128 128 // Use php sessions? … … 141 141 'enable_db_session_handler' => false, 142 142 143 // db_* parameters are passed to the DB object in $app->start(). 143 144 // DB credentials should be set as apache environment variables in httpd.conf, readable only by root. 144 145 'db_server' => null, … … 146 147 'db_user' => null, 147 148 'db_pass' => null, 149 'db_character_set' => '', 150 'db_collation' => '', 148 151 149 152 // CLI scripts will need this JSON file in the include path. … … 427 430 'db_debug' => $this->getParam('db_debug'), 428 431 'db_die_on_failure' => $this->getParam('db_die_on_failure'), 429 'timezone' => $this->getParam('mysql_timezone'), 432 'timezone' => $this->getParam('db_timezone'), 433 'character_set' => $this->getParam('db_character_set'), 434 'collation' => $this->getParam('db_collation'), 430 435 )); 431 436 -
trunk/lib/DB.inc.php
r679 r683 72 72 // Timezone for MySQL. 73 73 'timezone' => 'UTC', 74 75 // MySQL character set and collation. 76 'character_set' => '', 77 'collation' => '', 74 78 ); 75 79 … … 192 196 $this->_connected = true; 193 197 194 // Tell MySQL what character set we're using. Available only on MySQL versions > 4.01.01. 195 if ('' != $app->getParam('character_set') && isset($this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])) { 196 $this->query(sprintf("SET NAMES '%s';", $this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])); 197 } else { 198 $app->logMsg(sprintf('%s is not a known character_set.', $app->getParam('character_set')), LOG_ERR, __FILE__, __LINE__); 198 // If the mysql charset is not defined, try to determine a mysql charset from the app charset. 199 if ('' == $this->getParam('character_set') && '' != $app->getParam('character_set') && isset($this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])) { 200 $this->setParam(array('character_set' => $this->mysql_character_sets[mb_strtolower($app->getParam('character_set'))])); 201 } 202 if ('' != $this->getParam('character_set')) { 203 if ('' != $this->getParam('collation')) { 204 $this->query(sprintf("SET NAMES '%s' COLLATE '%s';", $this->getParam('character_set'), $this->getParam('collation'))); 205 } else { 206 $this->query(sprintf("SET NAMES '%s';", $this->getParam('character_set'))); 207 } 199 208 } 200 209
Note: See TracChangeset
for help on using the changeset viewer.