summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/allsites.php40
-rwxr-xr-xscripts/delete_status_network.sh21
-rwxr-xr-xscripts/getvaliddaemons.php3
-rwxr-xr-xscripts/jabberqueuehandler.php20
-rwxr-xr-xscripts/publicqueuehandler.php20
-rw-r--r--scripts/setup.cfg.sample7
-rwxr-xr-xscripts/setup_status_network.sh10
-rwxr-xr-xscripts/startdaemons.sh23
-rwxr-xr-xscripts/xmppconfirmhandler.php20
-rwxr-xr-xscripts/xmppdaemon.php22
10 files changed, 131 insertions, 55 deletions
diff --git a/scripts/allsites.php b/scripts/allsites.php
new file mode 100755
index 000000000..d6768c278
--- /dev/null
+++ b/scripts/allsites.php
@@ -0,0 +1,40 @@
+#!/usr/bin/env php
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2009, Control Yourself, 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/>.
+ */
+
+# Abort if called from a web server
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+
+$helptext = <<<ENDOFHELP
+allsites.php - list all sites configured for multi-site use
+
+returns the nickname of each site configured for multi-site use
+
+ENDOFHELP;
+
+require_once INSTALLDIR.'/scripts/commandline.inc';
+
+$sn = new Status_network();
+
+if ($sn->find()) {
+ while ($sn->fetch()) {
+ print "$sn->nickname\n";
+ }
+} \ No newline at end of file
diff --git a/scripts/delete_status_network.sh b/scripts/delete_status_network.sh
new file mode 100755
index 000000000..32187382c
--- /dev/null
+++ b/scripts/delete_status_network.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+source /etc/laconica/setup.cfg
+
+export nickname=$1
+
+export database=$nickname$DBBASE
+
+# Create the db
+
+mysqladmin -h $DBHOST -u $ADMIN --password=$ADMINPASS -f drop $database
+
+mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
+
+delete from status_network where nickname = '$nickname';
+
+ENDOFCOMMANDS
+
+for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do
+ rm -Rf $top/$nickname
+done
diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php
index 198ea8fb9..97c230784 100755
--- a/scripts/getvaliddaemons.php
+++ b/scripts/getvaliddaemons.php
@@ -38,9 +38,6 @@ if(common_config('xmpp','enabled')) {
echo "xmppdaemon.php jabberqueuehandler.php publicqueuehandler.php ";
echo "xmppconfirmhandler.php ";
}
-if(common_config('memcached','enabled')) {
- echo "memcachedqueuehandler.php ";
-}
if(common_config('twitterbridge','enabled')) {
echo "twitterstatusfetcher.php ";
}
diff --git a/scripts/jabberqueuehandler.php b/scripts/jabberqueuehandler.php
index a44993236..5b581629d 100755
--- a/scripts/jabberqueuehandler.php
+++ b/scripts/jabberqueuehandler.php
@@ -20,13 +20,13 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-$shortoptions = 'r::';
-$longoptions = array('resource::');
+$shortoptions = 'i::';
+$longoptions = array('id::');
$helptext = <<<END_OF_JABBER_HELP
Daemon script for pushing new notices to Jabber users.
- -r --resource Jabber Resource ID (default to config)
+ -i --id Identity (default none)
END_OF_JABBER_HELP;
@@ -63,16 +63,16 @@ if (common_config('xmpp','enabled')==false) {
exit();
}
-if (have_option('r')) {
- $resource = get_option_value('r');
-} else if (have_option('--resource')) {
- $resource = get_option_value('--resource');
+if (have_option('i')) {
+ $id = get_option_value('i');
+} else if (have_option('--id')) {
+ $id = get_option_value('--id');
} else if (count($args) > 0) {
- $resource = $args[0];
+ $id = $args[0];
} else {
- $resource = null;
+ $id = null;
}
-$handler = new JabberQueueHandler($resource);
+$handler = new JabberQueueHandler($id);
$handler->runOnce();
diff --git a/scripts/publicqueuehandler.php b/scripts/publicqueuehandler.php
index 58ecc1745..701d50e01 100755
--- a/scripts/publicqueuehandler.php
+++ b/scripts/publicqueuehandler.php
@@ -20,13 +20,13 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-$shortoptions = 'r::';
-$longoptions = array('resource::');
+$shortoptions = 'i::';
+$longoptions = array('id::');
$helptext = <<<END_OF_PUBLIC_HELP
Daemon script for pushing new notices to public XMPP subscribers.
- -r --resource Jabber Resource ID
+ -i --id Identity (default none)
END_OF_PUBLIC_HELP;
@@ -61,16 +61,16 @@ if (common_config('xmpp','enabled')==false) {
exit();
}
-if (have_option('r')) {
- $resource = get_option_value('r');
-} else if (have_option('--resource')) {
- $resource = get_option_value('--resource');
+if (have_option('i')) {
+ $id = get_option_value('i');
+} else if (have_option('--id')) {
+ $id = get_option_value('--id');
} else if (count($args) > 0) {
- $resource = $args[0];
+ $id = $args[0];
} else {
- $resource = null;
+ $id = null;
}
-$handler = new PublicQueueHandler($resource);
+$handler = new PublicQueueHandler($id);
$handler->runOnce();
diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample
index dd3c2705f..8d03b06f5 100644
--- a/scripts/setup.cfg.sample
+++ b/scripts/setup.cfg.sample
@@ -1,13 +1,14 @@
# CONFIGURATION FILE for setup_status_network.sh
-# Base database name; full name will include nickname
-
-export DBHOST=masterdb.example.net
+export DBHOST=localhost
+export DBHOSTNAME=masterdb.example.net
export DBBASE=_example_net
export USERBASE=_example_net
export ADMIN=root
export ADMINPASS=yourpassword
export SITEDB=example_net_site
export AVATARBASE=/var/www/avatar.example.net
+export BACKGROUNDBASE=/var/www/background.example.net
+export FILEBASE=/var/www/file.example.net
export PWDGEN="pwgen 20"
diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh
index 29ee010ed..17440640e 100755
--- a/scripts/setup_status_network.sh
+++ b/scripts/setup_status_network.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-source ./setup.cfg
+source /etc/laconica/setup.cfg
export nickname=$1
export sitename=$2
@@ -22,9 +22,11 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';
INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created)
-VALUES ('$nickname', '$DBHOST', '$username', '$password', '$database', '$sitename', now());
+VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now());
ENDOFCOMMANDS
-mkdir $AVATARBASE/$nickname
-chmod a+w $AVATARBASE/$nickname
+for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do
+ mkdir $top/$nickname
+ chmod a+w $top/$nickname
+done
diff --git a/scripts/startdaemons.sh b/scripts/startdaemons.sh
index 053c4f8ee..9ead20acd 100755
--- a/scripts/startdaemons.sh
+++ b/scripts/startdaemons.sh
@@ -20,12 +20,27 @@
# This program tries to start the daemons for Laconica.
# Note that the 'maildaemon' needs to run as a mail filter.
+ARGSG=
+ARGSD=
+
+if [ $# -gt 0 ]; then
+ ARGSG="$ARGSG -s$1"
+ ID=`echo $1 | sed s/\\\\./_/g`
+ ARGSD="$ARGSD -s$1 -i$ID"
+fi
+
+if [ $# -gt 1 ]; then
+ ARGSD="$ARGSD -p$2"
+ ARGSG="$ARGSG -p$2"
+fi
+
DIR=`dirname $0`
-DAEMONS=`php $DIR/getvaliddaemons.php`
+DAEMONS=`php $DIR/getvaliddaemons.php $ARGSG`
for f in $DAEMONS; do
- echo -n "Starting $f...";
- php $DIR/$f
- echo "DONE."
+ printf "Starting $f...";
+ php $DIR/$f $ARGSD
+ printf "DONE.\n"
+
done
diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php
index 883934fd6..d6821ddef 100755
--- a/scripts/xmppconfirmhandler.php
+++ b/scripts/xmppconfirmhandler.php
@@ -20,13 +20,13 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-$shortoptions = 'r::';
-$longoptions = array('resource::');
+$shortoptions = 'i::';
+$longoptions = array('id::');
$helptext = <<<END_OF_JABBER_HELP
Daemon script for pushing new confirmations to Jabber users.
- -r --resource Jabber Resource ID (default to config)
+ -i --id Identity (default none)
END_OF_JABBER_HELP;
@@ -147,17 +147,17 @@ if (common_config('xmpp','enabled')==false) {
exit();
}
-if (have_option('r')) {
- $resource = get_option_value('r');
-} else if (have_option('--resource')) {
- $resource = get_option_value('--resource');
+if (have_option('i')) {
+ $id = get_option_value('i');
+} else if (have_option('--id')) {
+ $id = get_option_value('--id');
} else if (count($args) > 0) {
- $resource = $args[0];
+ $id = $args[0];
} else {
- $resource = null;
+ $id = null;
}
-$handler = new XmppConfirmHandler($resource);
+$handler = new XmppConfirmHandler($id);
$handler->runOnce();
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index 661631937..3eecfec29 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -20,13 +20,13 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-$shortoptions = 'r::';
-$longoptions = array('resource::');
+$shortoptions = 'i::';
+$longoptions = array('id::');
$helptext = <<<END_OF_XMPP_HELP
Daemon script for receiving new notices from Jabber users.
- -r --resource Jabber Resource ID (default to config)
+ -i --id Identity (default none)
END_OF_XMPP_HELP;
@@ -52,7 +52,7 @@ class XMPPDaemon extends Daemon
}
if ($resource) {
- $this->resource = $resource;
+ $this->resource = $resource . 'daemon';
} else {
$this->resource = common_config('xmpp', 'resource') . 'daemon';
}
@@ -323,16 +323,16 @@ if (common_config('xmpp','enabled')==false) {
exit();
}
-if (have_option('r')) {
- $resource = get_option_value('r');
-} else if (have_option('--resource')) {
- $resource = get_option_value('--resource');
+if (have_option('i')) {
+ $id = get_option_value('i');
+} else if (have_option('--id')) {
+ $id = get_option_value('--id');
} else if (count($args) > 0) {
- $resource = $args[0];
+ $id = $args[0];
} else {
- $resource = null;
+ $id = null;
}
-$daemon = new XMPPDaemon($resource);
+$daemon = new XMPPDaemon($id);
$daemon->runOnce();