diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/clearcache.php | 4 | ||||
-rwxr-xr-x | scripts/fixup_inboxes.php | 4 | ||||
-rwxr-xr-x | scripts/getvaliddaemons.php | 4 | ||||
-rwxr-xr-x | scripts/imdaemon.php (renamed from scripts/xmppdaemon.php) | 43 | ||||
-rw-r--r-- | scripts/showcache.php | 4 | ||||
-rwxr-xr-x | scripts/stopdaemons.sh | 4 | ||||
-rw-r--r-- | scripts/uncache_users.php | 6 |
7 files changed, 30 insertions, 39 deletions
diff --git a/scripts/clearcache.php b/scripts/clearcache.php index 0fb75daa0..c67d6275d 100644 --- a/scripts/clearcache.php +++ b/scripts/clearcache.php @@ -38,7 +38,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; $karg = get_option_value('k', 'key'); if (!empty($karg)) { - $k = common_cache_key($karg); + $k = Cache::key($karg); } else { $table = get_option_value('t', 'table'); if (empty($table)) { @@ -55,7 +55,7 @@ if (!empty($karg)) { print "Clearing key '$k'..."; -$c = common_memcache(); +$c = Cache::instance(); if (empty($c)) { die("Can't initialize cache object!\n"); diff --git a/scripts/fixup_inboxes.php b/scripts/fixup_inboxes.php index d55a53885..c6e4fd071 100755 --- a/scripts/fixup_inboxes.php +++ b/scripts/fixup_inboxes.php @@ -46,7 +46,7 @@ if ($start_at) { } $cnt = $user->find(); -$cache = common_memcache(); +$cache = Cache::instance(); while ($user->fetch()) { common_log(LOG_INFO, 'Updating inbox for user ' . $user->id); @@ -76,6 +76,6 @@ while ($user->fetch()) { $inbox->free(); unset($inbox); if ($cache) { - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); + $cache->delete(Cache::key('user:notices_with_friends:' . $user->id)); } } diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php index a332e06b5..80c21bce5 100755 --- a/scripts/getvaliddaemons.php +++ b/scripts/getvaliddaemons.php @@ -39,9 +39,7 @@ $daemons = array(); $daemons[] = INSTALLDIR.'/scripts/queuedaemon.php'; -if(common_config('xmpp','enabled')) { - $daemons[] = INSTALLDIR.'/scripts/xmppdaemon.php'; -} +$daemons[] = INSTALLDIR.'/scripts/imdaemon.php'; if (Event::handle('GetValidDaemons', array(&$daemons))) { foreach ($daemons as $daemon) { diff --git a/scripts/xmppdaemon.php b/scripts/imdaemon.php index abd7cc22b..0ce74667c 100755 --- a/scripts/xmppdaemon.php +++ b/scripts/imdaemon.php @@ -23,21 +23,19 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'fi::a'; $longoptions = array('id::', 'foreground', 'all'); -$helptext = <<<END_OF_XMPP_HELP -Daemon script for receiving new notices from Jabber users. +$helptext = <<<END_OF_IM_HELP +Daemon script for receiving new notices from IM users. -i --id Identity (default none) -a --all Handle XMPP for all local sites (requires Stomp queue handler, status_network setup) -f --foreground Stay in the foreground (default background) -END_OF_XMPP_HELP; +END_OF_IM_HELP; require_once INSTALLDIR.'/scripts/commandline.inc'; -require_once INSTALLDIR . '/lib/jabber.php'; - -class XMPPDaemon extends SpawningDaemon +class ImDaemon extends SpawningDaemon { protected $allsites = false; @@ -45,7 +43,7 @@ class XMPPDaemon extends SpawningDaemon { if ($threads != 1) { // This should never happen. :) - throw new Exception("XMPPDaemon can must run single-threaded"); + throw new Exception("IMDaemon can must run single-threaded"); } parent::__construct($id, $daemonize, $threads); $this->allsites = $allsites; @@ -53,9 +51,9 @@ class XMPPDaemon extends SpawningDaemon function runThread() { - common_log(LOG_INFO, 'Waiting to listen to XMPP and queues'); + common_log(LOG_INFO, 'Waiting to listen to IM connections and queues'); - $master = new XmppMaster($this->get_id(), $this->processManager()); + $master = new ImMaster($this->get_id(), $this->processManager()); $master->init($this->allsites); $master->service(); @@ -66,7 +64,7 @@ class XMPPDaemon extends SpawningDaemon } -class XmppMaster extends IoMaster +class ImMaster extends IoMaster { protected $processManager; @@ -82,25 +80,20 @@ class XmppMaster extends IoMaster */ function initManagers() { - if (common_config('xmpp', 'enabled')) { + $classes = array(); + if (Event::handle('StartImDaemonIoManagers', array(&$classes))) { $qm = QueueManager::get(); - $qm->setActiveGroup('xmpp'); - $this->instantiate($qm); - $this->instantiate(XmppManager::get()); - $this->instantiate($this->processManager); + $qm->setActiveGroup('im'); + $classes[] = $qm; + $classes[] = $this->processManager; + } + Event::handle('EndImDaemonIoManagers', array(&$classes)); + foreach ($classes as $class) { + $this->instantiate($class); } } } -// Abort immediately if xmpp is not enabled, otherwise the daemon chews up -// lots of CPU trying to connect to unconfigured servers -// @fixme do this check after we've run through the site list so we -// don't have to find an XMPP site to start up when using --all mode. -if (common_config('xmpp','enabled')==false) { - print "Aborting daemon - xmpp is disabled\n"; - exit(1); -} - if (version_compare(PHP_VERSION, '5.2.6', '<')) { $arch = php_uname('m'); if ($arch == 'x86_64' || $arch == 'amd64') { @@ -120,6 +113,6 @@ if (have_option('i', 'id')) { $foreground = have_option('f', 'foreground'); $all = have_option('a') || have_option('--all'); -$daemon = new XMPPDaemon($id, !$foreground, 1, $all); +$daemon = new ImDaemon($id, !$foreground, 1, $all); $daemon->runOnce(); diff --git a/scripts/showcache.php b/scripts/showcache.php index 93b57a484..8ef08467d 100644 --- a/scripts/showcache.php +++ b/scripts/showcache.php @@ -38,7 +38,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; $karg = get_option_value('k'); if (!empty($karg)) { - $k = common_cache_key($karg); + $k = Cache::key($karg); } else { $table = get_option_value('t'); if (empty($table)) { @@ -55,7 +55,7 @@ if (!empty($karg)) { print "Checking key '$k'...\n"; -$c = common_memcache(); +$c = Cache::instance(); if (empty($c)) { die("Can't initialize cache object!\n"); diff --git a/scripts/stopdaemons.sh b/scripts/stopdaemons.sh index c790f1f34..bc1230e64 100755 --- a/scripts/stopdaemons.sh +++ b/scripts/stopdaemons.sh @@ -23,8 +23,8 @@ SDIR=`dirname $0` DIR=`php $SDIR/getpiddir.php` -for f in jabberhandler ombhandler publichandler smshandler pinghandler \ - xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \ +for f in ombhandler smshandler pinghandler \ + twitterhandler facebookhandler \ twitterstatusfetcher synctwitterfriends pluginhandler rsscloudhandler; do FILES="$DIR/$f.*.pid" diff --git a/scripts/uncache_users.php b/scripts/uncache_users.php index 5a1d33030..eb7e39802 100644 --- a/scripts/uncache_users.php +++ b/scripts/uncache_users.php @@ -34,7 +34,7 @@ common_log(LOG_INFO, 'Updating user inboxes.'); $ids = file($id_file); -$memc = common_memcache(); +$memc = Cache::instance(); foreach ($ids as $id) { @@ -47,6 +47,6 @@ foreach ($ids as $id) { $user->decache(); - $memc->delete(common_cache_key('user:notices_with_friends:'. $user->id)); - $memc->delete(common_cache_key('user:notices_with_friends:'. $user->id . ';last')); + $memc->delete(Cache::key('user:notices_with_friends:'. $user->id)); + $memc->delete(Cache::key('user:notices_with_friends:'. $user->id . ';last')); } |