summaryrefslogtreecommitdiff
path: root/classes/Status_network.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-01-13 19:17:49 +0000
committerZach Copley <zach@status.net>2010-01-13 19:17:49 +0000
commitc3188fd1fece2be7f7c4211d28f4a3d3a59c8fa1 (patch)
treeaa8018e132936b00fc63224e75ca134d68999b4e /classes/Status_network.php
parent43170b3d18153b3dfd8675bd77ae1133eed8148a (diff)
parent0e1f2d4b47e5e340679c4245b62e1d64c6b9c9b9 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes/Status_network.php')
-rw-r--r--classes/Status_network.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/classes/Status_network.php b/classes/Status_network.php
index 776f6abb0..ef8e1ed43 100644
--- a/classes/Status_network.php
+++ b/classes/Status_network.php
@@ -49,6 +49,13 @@ class Status_network extends DB_DataObject
static $cache = null;
static $base = null;
+ /**
+ * @param string $dbhost
+ * @param string $dbuser
+ * @param string $dbpass
+ * @param string $dbname
+ * @param array $servers memcached servers to use for caching config info
+ */
static function setupDB($dbhost, $dbuser, $dbpass, $dbname, $servers)
{
global $config;
@@ -60,12 +67,17 @@ class Status_network extends DB_DataObject
if (class_exists('Memcache')) {
self::$cache = new Memcache();
+ // Can't close persistent connections, making forking painful.
+ //
+ // @fixme only do this in *parent* CLI processes.
+ // single-process and child-processes *should* use persistent.
+ $persist = php_sapi_name() != 'cli';
if (is_array($servers)) {
foreach($servers as $server) {
- self::$cache->addServer($server);
+ self::$cache->addServer($server, 11211, $persist);
}
} else {
- self::$cache->addServer($servers);
+ self::$cache->addServer($servers, 11211, $persist);
}
}
@@ -89,7 +101,7 @@ class Status_network extends DB_DataObject
if (empty($sn)) {
$sn = self::staticGet($k, $v);
if (!empty($sn)) {
- self::$cache->set($ck, $sn);
+ self::$cache->set($ck, clone($sn));
}
}
@@ -121,6 +133,11 @@ class Status_network extends DB_DataObject
return parent::delete();
}
+ /**
+ * @param string $servername hostname
+ * @param string $pathname URL base path
+ * @param string $wildcard hostname suffix to match wildcard config
+ */
static function setupSite($servername, $pathname, $wildcard)
{
global $config;