From 206229875511d24a97a0aac79605f6868d21ee7f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 21 May 2010 14:07:59 -0700 Subject: Add $config['queue']['stomp_enqueue_to'] override for which queue server to send to. Must be set to a value that matches one of the entries in $config['queue']['stomp_server'] array, otherwise ignored. --- lib/stompqueuemanager.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 5d5c7ccfb..de4ba7f01 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -122,7 +122,19 @@ class StompQueueManager extends QueueManager public function enqueue($object, $queue) { $this->_connect(); - return $this->_doEnqueue($object, $queue, $this->defaultIdx); + if (common_config('queue', 'stomp_enqueue_on')) { + // We're trying to force all writes to a single server. + // WARNING: this might do odd things if that server connection dies. + $idx = array_search(common_config('queue', 'stomp_enqueue_on'), + $this->servers); + if ($idx === false) { + common_log(LOG_ERR, 'queue stomp_enqueue_on setting does not match our server list.'); + $idx = $this->defaultIdx; + } + } else { + $idx = $this->defaultIdx; + } + return $this->_doEnqueue($object, $queue, $idx); } /** -- cgit v1.2.3 From c5b61078e1548fba2820620e2e8f5fcbbda611a8 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 27 May 2010 13:49:23 -0700 Subject: Pass auth user into Atom feed generators (needed for outputting favorited status in statusnet:notice_info tag) --- lib/atomgroupnoticefeed.php | 5 +++-- lib/atomnoticefeed.php | 17 +++++++++++++++-- lib/atomusernoticefeed.php | 5 +++-- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/atomgroupnoticefeed.php b/lib/atomgroupnoticefeed.php index 08c1c707c..7934a4f9e 100644 --- a/lib/atomgroupnoticefeed.php +++ b/lib/atomgroupnoticefeed.php @@ -50,12 +50,13 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed * Constructor * * @param Group $group the group for the feed + * @param User $cur the current authenticated user, if any * @param boolean $indent flag to turn indenting on or off * * @return void */ - function __construct($group, $indent = true) { - parent::__construct($indent); + function __construct($group, $cur = null, $indent = true) { + parent::__construct($cur, $indent); $this->group = $group; $title = sprintf(_("%s timeline"), $group->nickname); diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php index 35a45118c..ef44de4b6 100644 --- a/lib/atomnoticefeed.php +++ b/lib/atomnoticefeed.php @@ -44,9 +44,22 @@ if (!defined('STATUSNET')) */ class AtomNoticeFeed extends Atom10Feed { - function __construct($indent = true) { + var $cur; + + /** + * Constructor - adds a bunch of XML namespaces we need in our + * notice-specific Atom feeds, and allows setting the current + * authenticated user (useful for API methods). + * + * @param User $cur the current authenticated user (optional) + * @param boolean $indent Whether to indent XML output + * + */ + function __construct($cur = null, $indent = true) { parent::__construct($indent); + $this->cur = $cur; + // Feeds containing notice info use these namespaces $this->addNamespace( @@ -115,7 +128,7 @@ class AtomNoticeFeed extends Atom10Feed $source = $this->showSource(); $author = $this->showAuthor(); - $cur = common_current_user(); + $cur = empty($this->cur) ? common_current_user() : $this->cur; $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur)); } diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php index 428cc2de2..b569d9379 100644 --- a/lib/atomusernoticefeed.php +++ b/lib/atomusernoticefeed.php @@ -50,13 +50,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed * Constructor * * @param User $user the user for the feed + * @param User $cur the current authenticated user, if any * @param boolean $indent flag to turn indenting on or off * * @return void */ - function __construct($user, $indent = true) { - parent::__construct($indent); + function __construct($user, $cur = null, $indent = true) { + parent::__construct($cur, $indent); $this->user = $user; if (!empty($user)) { $profile = $user->getProfile(); -- cgit v1.2.3 From 697a9948df3c9d4275b3525227007bfd5a1c5709 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 27 May 2010 14:18:08 -0700 Subject: Ticket #2329: fix for use of _m() translation functions from outside of plugin directories --- lib/language.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/language.php b/lib/language.php index 64b59e739..3846b8f35 100644 --- a/lib/language.php +++ b/lib/language.php @@ -205,12 +205,20 @@ function _mdomain($backtrace) if (DIRECTORY_SEPARATOR !== '/') { $path = strtr($path, DIRECTORY_SEPARATOR, '/'); } - $cut = strpos($path, '/plugins/') + 9; - $cut2 = strpos($path, '/', $cut); - if ($cut && $cut2) { - $cached[$path] = substr($path, $cut, $cut2 - $cut); - } else { + $plug = strpos($path, '/plugins/'); + if ($plug === false) { + // We're not in a plugin; return null for the default domain. return null; + } else { + $cut = $plug + 9; + $cut2 = strpos($path, '/', $cut); + if ($cut2) { + $cached[$path] = substr($path, $cut, $cut2 - $cut); + } else { + // We might be running directly from the plugins dir? + // If so, there's no place to store locale info. + return null; + } } } return $cached[$path]; -- cgit v1.2.3