summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/delete_status_network.sh4
-rwxr-xr-xscripts/queuedaemon.php8
-rw-r--r--scripts/settag.php84
-rwxr-xr-xscripts/setup_status_network.sh4
4 files changed, 99 insertions, 1 deletions
diff --git a/scripts/delete_status_network.sh b/scripts/delete_status_network.sh
index f55f1486b..3a8ebdcfd 100755
--- a/scripts/delete_status_network.sh
+++ b/scripts/delete_status_network.sh
@@ -1,5 +1,9 @@
#!/bin/bash
+# live fast! die young!
+
+set -e
+
source /etc/statusnet/setup.cfg
export nickname=$1
diff --git a/scripts/queuedaemon.php b/scripts/queuedaemon.php
index c2e2351c3..30a8a9602 100755
--- a/scripts/queuedaemon.php
+++ b/scripts/queuedaemon.php
@@ -109,7 +109,13 @@ class QueueDaemon extends SpawningDaemon
$master = new QueueMaster($this->get_id());
$master->init($this->all);
- $master->service();
+ try {
+ $master->service();
+ } catch (Exception $e) {
+ common_log(LOG_ERR, "Unhandled exception: " . $e->getMessage() . ' ' .
+ str_replace("\n", " ", $e->getTraceAsString()));
+ return self::EXIT_ERR;
+ }
$this->log(LOG_INFO, 'finished servicing the queue');
diff --git a/scripts/settag.php b/scripts/settag.php
new file mode 100644
index 000000000..e91d5eb50
--- /dev/null
+++ b/scripts/settag.php
@@ -0,0 +1,84 @@
+#!/usr/bin/env php
+<?php
+/*
+ * StatusNet - a 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__) . '/..'));
+
+$shortoptions = 'd';
+$longoptions = array('delete');
+
+$helptext = <<<END_OF_SETTAG_HELP
+settag.php [options] <site> <tag>
+Set the tag <tag> for site <site>.
+
+With -d, delete the tag.
+
+END_OF_SETTAG_HELP;
+
+require_once INSTALLDIR.'/scripts/commandline.inc';
+
+if (count($args) != 2) {
+ show_help();
+ exit(1);
+}
+
+$nickname = $args[0];
+$tag = strtolower($args[1]);
+
+$sn = Status_network::memGet('nickname', $nickname);
+
+if (empty($sn)) {
+ print "No such site.\n";
+ exit(-1);
+}
+
+$tags = $sn->getTags();
+
+$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);
+ if (!$result) {
+ print "Couldn't update.\n";
+ exit(-1);
+ }
+ } else {
+ print "Already set.\n";
+ exit(-1);
+ }
+} else {
+ if (have_option('d', 'delete')) { // Delete
+ print "No such tag.\n";
+ exit(-1);
+ } else {
+ $tags[] = $tag;
+ $orig = clone($sn);
+ $sn->tags = implode('|', $tags);
+ $result = $sn->update($orig);
+ if (!$result) {
+ print "Couldn't update.\n";
+ exit(-1);
+ }
+ }
+}
diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh
index f502a169a..4ad808011 100755
--- a/scripts/setup_status_network.sh
+++ b/scripts/setup_status_network.sh
@@ -1,5 +1,9 @@
#!/bin/bash
+# live fast! die young!
+
+set -e
+
source /etc/statusnet/setup.cfg
# setup_status_net.sh mysite 'My Site' '1user' 'owner@example.com' 'Firsty McLastname'