* ñ = ñ * á = Á * * To proper utf8 * * Only testet on my own setup, so backup your database * * There was a few problem with indexes, but they were solved * by running the latin1 -> blob -> utf8 in one query * */ include_once "vendor/autoload.php"; use diversen\conf; use diversen\db; conf::setMainIni('base_path', realpath('.')); conf::loadMainCli(); $db = new db(); $db->connect(); function get_tables_db() { $db = new db(); $rows = $db->selectQuery('show tables'); $tables = array(); foreach ($rows as $table) { $tables[] = array_pop($table); } return $tables; } function get_table_create($table) { $db = new db();
/** * Do this after the commandline options has been parsed. * Examine the --domain flag and the --verbose flag * @param type $result */ public static function afterParse($result) { $verbose = $result->options['verbose']; conf::setMainIni('verbose', $verbose); // Check if other domain than default is being used $domain = $result->options['domain']; conf::setMainIni('domain', $domain); if ($domain != 'default' || empty($domain)) { $domain_ini = conf::pathBase() . "/config/multi/{$domain}/config.ini"; if (!file_exists($domain_ini)) { common::abort("No such domain - no configuration found: '{$domain_ini}'"); } else { // If domain is used - Load domain specific configuration conf::loadMainCli(); } } }
Add something like the following to the `config/config.ini` file: url = "mysql:dbname=demo;host=localhost;charset=utf8" db_init = "SET NAMES utf8" username = "******" password = "******" Run the script: php vendor/diversen/simple-php-classes/src/scripts/latin1-to-uft8.php */ include_once "vendor/autoload.php"; use diversen\conf; use diversen\db; use diversen\db\connect; conf::setMainIni('base_path', realpath('.')); if (!conf::loadMainCli()) { $str = <<<EOF Usage: create config/config.ini e.g.: mkdir config touch config/config.ini Put your credentials into config/config.ini Something like this: url = "mysql:dbname=demo;host=localhost;charset=utf8" db_init = "SET NAMES utf8" username = "******" password = "******"