diff options
author | Jeffery To <jeffery.to@gmail.com> | 2009-06-24 01:18:35 +0800 |
---|---|---|
committer | Jeffery To <jeffery.to@gmail.com> | 2009-06-24 01:18:35 +0800 |
commit | 65f784120b45dc187e28313fa2c2dca2c976c150 (patch) | |
tree | cf1cb3e34483466d4f4a312c528579292e7603fc /classes/Memcached_DataObject.php | |
parent | f7d488d4b2bfdc8dfa6b5a2bc2931dbf824509a0 (diff) | |
parent | eb40fbc17ad1efb0a4c51ee00b1e9408d2af382f (diff) |
Merge branch '0.8.x' into notice-search-no-results
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; } + } |