diff options
author | Jeffery To <jeffery.to@gmail.com> | 2009-06-26 15:30:24 +0800 |
---|---|---|
committer | Jeffery To <jeffery.to@gmail.com> | 2009-06-26 15:30:24 +0800 |
commit | 899aad747a466609542388f86bbd22da4360ed6d (patch) | |
tree | 55fab97917fe9f304164fb96b0f0a85a4524567d /classes/Memcached_DataObject.php | |
parent | 43680ed0c2cf83448d755fa1edff42711d06a82c (diff) | |
parent | 97ee517680979bf12e82eab99ecf943712fe97c9 (diff) |
Merge branch '0.8.x' into group-rss-empty
Diffstat (limited to 'classes/Memcached_DataObject.php')
-rw-r--r-- | classes/Memcached_DataObject.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 33ac70dd0..f7cbb9d5b 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -1,7 +1,7 @@ <?php /* * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, Controlez-Vous, Inc. + * Copyright (C) 2008, 2009, Control Yourself, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -193,7 +193,14 @@ class Memcached_DataObject extends DB_DataObject // unable to connect to sphinx' search daemon if (!$connected) { if ('mysql' === common_config('db', 'type')) { - $search_engine = new MySQLSearch($this, $table); + $type = common_config('search', 'type'); + if ($type == 'like') { + $search_engine = new MySQLLikeSearch($this, $table); + } else if ($type == 'fulltext') { + $search_engine = new MySQLSearch($this, $table); + } else { + throw new ServerException('Unknown search type: ' . $type); + } } else { $search_engine = new PGSearch($this, $table); } @@ -242,13 +249,16 @@ class Memcached_DataObject extends DB_DataObject if (common_config('db', 'type') == 'mysql' && common_config('db', 'utf8')) { $conn = $DB->connection; - if ($DB instanceof DB_mysqli) { - mysqli_set_charset($conn, 'utf8'); - } else if ($DB instanceof DB_mysql) { - mysql_set_charset('utf8', $conn); + if (!empty($conn)) { + if ($DB instanceof DB_mysqli) { + mysqli_set_charset($conn, 'utf8'); + } else if ($DB instanceof DB_mysql) { + mysql_set_charset('utf8', $conn); + } } } } return $result; } + } |