Ticket #3517: charset.diff
| File charset.diff, 5.4 KB (added by ryan, 5 years ago) |
|---|
-
wp-includes/wp-db.php
35 35 var $optiongroup_options; 36 36 var $postmeta; 37 37 38 var $charset; 39 var $collate; 40 38 41 /** 39 42 * Connects to the database server and selects a database 40 43 * @param string $dbuser … … 49 52 function __construct($dbuser, $dbpassword, $dbname, $dbhost) { 50 53 register_shutdown_function(array(&$this, "__destruct")); 51 54 55 if ( defined('DB_CHARSET') ) 56 $this->charset = DB_CHARSET; 57 58 if ( defined('DB_COLLATE') ) 59 $this->collate = DB_COLLATE; 60 52 61 $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword); 53 62 if (!$this->dbh) { 54 63 $this->bail(" … … 63 72 "); 64 73 } 65 74 75 if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') ) 76 $this->query("SET NAMES '$this->charset'"); 77 66 78 $this->select($dbname); 67 79 } 68 80 -
wp-includes/version.php
3 3 // This holds the version number in a separate file so we can bump it without cluttering the SVN 4 4 5 5 $wp_version = '2.2-bleeding'; 6 $wp_db_version = 4 772;6 $wp_db_version = 4845; 7 7 8 8 ?> -
wp-config-sample.php
4 4 define('DB_USER', 'username'); // Your MySQL username 5 5 define('DB_PASSWORD', 'password'); // ...and password 6 6 define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value 7 define('DB_CHARSET', 'utf8'); 8 define('DB_COLLATE', 'utf8_general_ci'); 7 9 8 10 // You can have multiple installations in one database if you give each a unique prefix 9 11 $table_prefix = 'wp_'; // Only numbers, letters, and underscores please! … … 18 20 19 21 define('ABSPATH', dirname(__FILE__).'/'); 20 22 require_once(ABSPATH.'wp-settings.php'); 21 ?> 22 No newline at end of file 23 ?> -
wp-admin/upgrade-schema.php
1 1 <?php 2 2 // Here we keep the DB structure and option values 3 3 4 $charset_collate = ''; 5 6 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { 7 if ( ! empty($wpdb->charset) ) 8 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 9 if ( ! empty($wpdb->collate) ) 10 $charset_collate .= " COLLATE $wpdb->collate"; 11 } 12 4 13 $wp_queries="CREATE TABLE $wpdb->categories ( 5 14 cat_ID bigint(20) NOT NULL auto_increment, 6 15 cat_name varchar(55) NOT NULL default '', … … 13 22 links_private tinyint(1) NOT NULL default '0', 14 23 PRIMARY KEY (cat_ID), 15 24 KEY category_nicename (category_nicename) 16 ) ;25 ) $charset_collate; 17 26 CREATE TABLE $wpdb->comments ( 18 27 comment_ID bigint(20) unsigned NOT NULL auto_increment, 19 28 comment_post_ID int(11) NOT NULL default '0', … … 33 42 PRIMARY KEY (comment_ID), 34 43 KEY comment_approved (comment_approved), 35 44 KEY comment_post_ID (comment_post_ID) 36 ) ;45 ) $charset_collate; 37 46 CREATE TABLE $wpdb->link2cat ( 38 47 rel_id bigint(20) NOT NULL auto_increment, 39 48 link_id bigint(20) NOT NULL default '0', 40 49 category_id bigint(20) NOT NULL default '0', 41 50 PRIMARY KEY (rel_id), 42 51 KEY link_id (link_id,category_id) 43 ) ;52 ) $charset_collate; 44 53 CREATE TABLE $wpdb->links ( 45 54 link_id bigint(20) NOT NULL auto_increment, 46 55 link_url varchar(255) NOT NULL default '', … … 59 68 PRIMARY KEY (link_id), 60 69 KEY link_category (link_category), 61 70 KEY link_visible (link_visible) 62 ) ;71 ) $charset_collate; 63 72 CREATE TABLE $wpdb->options ( 64 73 option_id bigint(20) NOT NULL auto_increment, 65 74 blog_id int(11) NOT NULL default '0', … … 74 83 autoload enum('yes','no') NOT NULL default 'yes', 75 84 PRIMARY KEY (option_id,blog_id,option_name), 76 85 KEY option_name (option_name) 77 ) ;86 ) $charset_collate; 78 87 CREATE TABLE $wpdb->post2cat ( 79 88 rel_id bigint(20) NOT NULL auto_increment, 80 89 post_id bigint(20) NOT NULL default '0', 81 90 category_id bigint(20) NOT NULL default '0', 82 91 PRIMARY KEY (rel_id), 83 92 KEY post_id (post_id,category_id) 84 ) ;93 ) $charset_collate; 85 94 CREATE TABLE $wpdb->postmeta ( 86 95 meta_id bigint(20) NOT NULL auto_increment, 87 96 post_id bigint(20) NOT NULL default '0', … … 90 99 PRIMARY KEY (meta_id), 91 100 KEY post_id (post_id), 92 101 KEY meta_key (meta_key) 93 ) ;102 ) $charset_collate; 94 103 CREATE TABLE $wpdb->posts ( 95 104 ID bigint(20) unsigned NOT NULL auto_increment, 96 105 post_author bigint(20) NOT NULL default '0', … … 119 128 PRIMARY KEY (ID), 120 129 KEY post_name (post_name), 121 130 KEY type_status_date (post_type,post_status,post_date,ID) 122 ) ;131 ) $charset_collate; 123 132 CREATE TABLE $wpdb->users ( 124 133 ID bigint(20) unsigned NOT NULL auto_increment, 125 134 user_login varchar(60) NOT NULL default '', … … 133 142 display_name varchar(250) NOT NULL default '', 134 143 PRIMARY KEY (ID), 135 144 KEY user_login_key (user_login) 136 ) ;145 ) $charset_collate; 137 146 CREATE TABLE $wpdb->usermeta ( 138 147 umeta_id bigint(20) NOT NULL auto_increment, 139 148 user_id bigint(20) NOT NULL default '0', … … 142 151 PRIMARY KEY (umeta_id), 143 152 KEY user_id (user_id), 144 153 KEY meta_key (meta_key) 145 ) ;";154 ) $charset_collate;"; 146 155 147 156 function populate_options() { 148 157 global $wpdb, $wp_db_version;
