summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Memcached_DataObject.php29
-rw-r--r--classes/Notice.php6
-rw-r--r--classes/Status_network.php28
3 files changed, 35 insertions, 28 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 9c2ac3e01..753fe954e 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -184,27 +184,20 @@ class Memcached_DataObject extends DB_DataObject
require_once INSTALLDIR.'/lib/search_engines.php';
static $search_engine;
if (!isset($search_engine)) {
- $connected = false;
- if (common_config('sphinx', 'enabled')) {
- $search_engine = new SphinxSearch($this, $table);
- $connected = $search_engine->is_connected();
- }
-
- // unable to connect to sphinx' search daemon
- if (!$connected) {
- if ('mysql' === common_config('db', 'type')) {
- $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);
- }
+ if (Event::handle('GetSearchEngine', array($this, $table, &$search_engine))) {
+ if ('mysql' === common_config('db', 'type')) {
+ $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 {
- $search_engine = new PGSearch($this, $table);
+ throw new ServerException('Unknown search type: ' . $type);
}
+ } else {
+ $search_engine = new PGSearch($this, $table);
}
+ }
}
return $search_engine;
}
diff --git a/classes/Notice.php b/classes/Notice.php
index 9886875cb..291e6202b 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -1254,6 +1254,12 @@ class Notice extends Memcached_DataObject
}
}
+ if (!empty($this->lat) && !empty($this->lon)) {
+ $xs->elementStart('geo', array('xmlns:georss' => 'http://www.georss.org/georss'));
+ $xs->element('georss:point', null, $this->lat . ' ' . $this->lon);
+ $xs->elementEnd('geo');
+ }
+
$xs->elementEnd('entry');
return $xs->getString();
diff --git a/classes/Status_network.php b/classes/Status_network.php
index fe4f0b0c5..b3117640d 100644
--- a/classes/Status_network.php
+++ b/classes/Status_network.php
@@ -57,14 +57,16 @@ class Status_network extends DB_DataObject
$config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/status_network.ini';
$config['db']['table_status_network'] = $dbname;
- self::$cache = new Memcache();
+ if (class_exists('Memcache')) {
+ self::$cache = new Memcache();
- if (is_array($servers)) {
- foreach($servers as $server) {
- self::$cache->addServer($server);
+ if (is_array($servers)) {
+ foreach($servers as $server) {
+ self::$cache->addServer($server);
+ }
+ } else {
+ self::$cache->addServer($servers);
}
- } else {
- self::$cache->addServer($servers);
}
self::$base = $dbname;
@@ -76,6 +78,10 @@ class Status_network extends DB_DataObject
static function memGet($k, $v)
{
+ if (!self::$cache) {
+ return self::staticGet($k, $v);
+ }
+
$ck = self::cacheKey($k, $v);
$sn = self::$cache->get($ck);
@@ -92,10 +98,12 @@ class Status_network extends DB_DataObject
function decache()
{
- $keys = array('nickname', 'hostname', 'pathname');
- foreach ($keys as $k) {
- $ck = self::cacheKey($k, $this->$k);
- self::$cache->delete($ck);
+ if (self::$cache) {
+ $keys = array('nickname', 'hostname', 'pathname');
+ foreach ($keys as $k) {
+ $ck = self::cacheKey($k, $this->$k);
+ self::$cache->delete($ck);
+ }
}
}