Changeset 1232

Show
Ignore:
Timestamp:
01/05/09 06:03:31 (2 years ago)
Author:
bermi
Message:

Important: Data integrity issue on MySQL

Before rev.1232 MySQL on some setups, connections where opened using PHP's default
encoding latin1 this caused that UTF8 data written by Akelos could not be edited using other DB tools like phpMyAdmin

This change solves the issue for new applications, but existing applications can fix this by backing up your database
and following the steps at http://codesnippets.joyent.com/posts/show/84 before defining AK_SET_UTF8_ON_MYSQL_CONNECT on your configuration file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG.txt

    r1205 r1232  
     1[1232] Important: Data integrity issue on MySQL 
     2 
     3Before rev.1232 MySQL on some setups, connections where opened using PHP's default  
     4encoding latin1 this caused that UTF8 data written by Akelos could not be edited using other DB tools like phpMyAdmin 
     5 
     6This change solves the issue for new applications, but existing applications can fix this by backing up your database 
     7and following the steps at http://codesnippets.joyent.com/posts/show/84 before defining AK_SET_UTF8_ON_MYSQL_CONNECT on your configuration file. 
     8 
    19[1205] Adding new configuration script to generate config.php and database.yml 
    210 
  • trunk/config/boot.php

    r357 r1232  
    2121defined('AK_LIB_DIR') ? null : define('AK_LIB_DIR',AK_FRAMEWORK_DIR.DS.'lib'); 
    2222 
     23/** 
     24 *  Before rev.1232 MySQL on some setups, connections where opened using PHP's default  
     25 *  encoding latin1 this caused that UTF8 data written by Akelos could not be edited using other DB tools. 
     26 *   
     27 *  We can't automatically fix this for older applications as you might need to backup your database and follow the steps at 
     28 *  http://codesnippets.joyent.com/posts/show/84 before defining AK_SET_UTF8_ON_MYSQL_CONNECT on your configuration file 
     29 *  to fix this issue 
     30 */ 
     31defined('AK_SET_UTF8_ON_MYSQL_CONNECT') ? null : define('AK_SET_UTF8_ON_MYSQL_CONNECT', true); 
     32 
    2333require_once(AK_LIB_DIR.DS.'constants.php'); 
    2434 
  • trunk/lib/AkActiveRecord/AkDbAdapters/AkMysqlDbAdapter.php

    r647 r1232  
    8181    } 
    8282     
     83    function connect($die_on_error=true) 
     84    { 
     85        parent::connect($die_on_error); 
     86        if(defined('AK_SET_UTF8_ON_MYSQL_CONNECT') && AK_SET_UTF8_ON_MYSQL_CONNECT){ 
     87                isset($this->connection->_connectionID) && mysql_set_charset('utf8', $this->connection->_connectionID); 
     88        } 
     89    } 
     90     
    8391} 
    8492?>