summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/fixup_status_network.php37
-rwxr-xr-xscripts/getvaliddaemons.php4
-rwxr-xr-xscripts/imdaemon.php (renamed from scripts/xmppdaemon.php)43
-rw-r--r--scripts/settag.php12
-rwxr-xr-xscripts/setup_status_network.sh6
-rwxr-xr-xscripts/stopdaemons.sh4
6 files changed, 65 insertions, 41 deletions
diff --git a/scripts/fixup_status_network.php b/scripts/fixup_status_network.php
new file mode 100644
index 000000000..def1eaa88
--- /dev/null
+++ b/scripts/fixup_status_network.php
@@ -0,0 +1,37 @@
+#!/usr/bin/env php
+<?php
+/*
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+
+require_once INSTALLDIR.'/scripts/commandline.inc';
+
+common_log(LOG_INFO, 'Beginning status_network conversion...');
+
+$sn = new Status_network();
+$sn->find();
+while ($sn->fetch()) {
+ try {
+ $sn->setTags(explode('|', $sn->tags));
+ } catch (Exception $e) {
+ common_log(LOG_ERR, $e->getMessage());
+ }
+}
+
+common_log(LOG_INFO, 'Completed status_network conversion...');
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/settag.php b/scripts/settag.php
index d1b06ff10..ca260f7bf 100644
--- a/scripts/settag.php
+++ b/scripts/settag.php
@@ -39,11 +39,10 @@ if (count($args) < 1) {
}
$nickname = $args[0];
-
$sn = Status_network::memGet('nickname', $nickname);
if (empty($sn)) {
- print "No such site.\n";
+ print "No such site ($nickname).\n";
exit(-1);
}
@@ -54,16 +53,13 @@ if (count($args) == 1) {
exit(0);
}
$tag = $args[1];
-
$i = array_search($tag, $tags);
if ($i !== false) {
if (have_option('d', 'delete')) { // Delete
unset($tags[$i]);
- $orig = clone($sn);
- $sn->tags = implode('|', $tags);
- $result = $sn->update($orig);
+ $result = $sn->setTags($tags);
if (!$result) {
print "Couldn't update.\n";
exit(-1);
@@ -78,9 +74,7 @@ if ($i !== false) {
exit(-1);
} else {
$tags[] = $tag;
- $orig = clone($sn);
- $sn->tags = implode('|', $tags);
- $result = $sn->update($orig);
+ $result = $sn->setTags($tags);
if (!$result) {
print "Couldn't update.\n";
exit(-1);
diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh
index 4ebb696c7..3dd739030 100755
--- a/scripts/setup_status_network.sh
+++ b/scripts/setup_status_network.sh
@@ -44,8 +44,8 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';
-INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created, tags)
-VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now(), '$tags');
+INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created)
+VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now());
ENDOFCOMMANDS
@@ -56,6 +56,8 @@ done
php $PHPBASE/scripts/checkschema.php -s"$server"
+php $PHPBASE/scripts/settag.php -s"$server" "$nickname" "$tags"
+
php $PHPBASE/scripts/registeruser.php \
-s"$server" \
-n"$nickname" \
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"