diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-06-13 17:21:00 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-06-13 17:21:00 +0000 |
commit | 12de05107e4c8b006bde6ee8916f34eb476d08da (patch) | |
tree | 123ee54ecd1f3f777373b7df54a4604012d43640 /wp-includes/wp-db.php | |
parent | e51c7a9ca4bfdb45fa3ec7334bd33871e78c68b1 (diff) | |
download | wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.tar.gz wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.tar.xz wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.zip |
WP Merge with revision 8075
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1328 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wp-db.php')
-rw-r--r-- | wp-includes/wp-db.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index b7fb414..00c7e81 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -104,9 +104,19 @@ class wpdb { $this->ready = true; - if ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ) - $this->query("SET NAMES '$this->charset'"); - + if ( $this->supports_collation() ) { + $collation_query = ''; + if ( !empty($this->charset) ) { + $collation_query = "SET NAMES '{$this->charset}'"; + if (!empty($this->collate) ) + $collation_query .= " COLLATE '{$this->collate}'"; + } + + if ( !empty($collation_query) ) + $this->query($collation_query); + + } + $this->select($dbname, $this->dbh); } @@ -115,6 +125,7 @@ class wpdb { } function set_prefix($prefix) { + if ( preg_match('|[^a-z0-9_]|i', $prefix) ) return new WP_Error('invalid_db_prefix', 'Invalid database prefix'); // No gettext here |