summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/commandline.inc1
-rw-r--r--scripts/deleteuser.php68
-rwxr-xr-xscripts/fixup_conversations.php14
-rwxr-xr-xscripts/maildaemon.php4
-rwxr-xr-xscripts/synctwitterfriends.php2
-rwxr-xr-xscripts/twitterqueuehandler.php2
-rwxr-xr-xscripts/twitterstatusfetcher.php2
7 files changed, 79 insertions, 14 deletions
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
index 1573b569d..9029bb19d 100644
--- a/scripts/commandline.inc
+++ b/scripts/commandline.inc
@@ -27,6 +27,7 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
}
define('STATUSNET', true);
+define('LACONICA', true); // compatibility
// Set various flags so we don't time out on long-running processes
diff --git a/scripts/deleteuser.php b/scripts/deleteuser.php
new file mode 100644
index 000000000..52389123c
--- /dev/null
+++ b/scripts/deleteuser.php
@@ -0,0 +1,68 @@
+#!/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 = 'i::n::y';
+$longoptions = array('id::nickname::yes');
+
+$helptext = <<<END_OF_DELETEUSER_HELP
+deleteuser.php [options]
+deletes a user from the database
+
+ -i --id ID of the user
+ -n --nickname nickname of the user
+ -y --yes do not wait for confirmation
+
+END_OF_DELETEUSER_HELP;
+
+require_once INSTALLDIR.'/scripts/commandline.inc';
+
+if (have_option('i', 'id')) {
+ $id = get_option_value('i', 'id');
+ $user = User::staticGet('id', $id);
+ if (empty($user)) {
+ print "Can't find user with ID $id\n";
+ exit(1);
+ }
+} else if (have_option('n', 'nickname')) {
+ $nickname = get_option_value('n', 'nickname');
+ $user = User::staticGet('nickname', $nickname);
+ if (empty($user)) {
+ print "Can't find user with nickname '$nickname'\n";
+ exit(1);
+ }
+} else {
+ print "You must provide either an ID or a nickname.\n";
+ exit(1);
+}
+
+if (!have_option('y', 'yes')) {
+ print "About to PERMANENTLY delete user '{$user->nickname}' ({$user->id}). Are you sure? [y/N] ";
+ $response = fgets(STDIN);
+ if (strtolower(trim($response)) != 'y') {
+ print "Aborting.\n";
+ exit(0);
+ }
+}
+
+print "Deleting...";
+$user->delete();
+print "DONE.\n";
diff --git a/scripts/fixup_conversations.php b/scripts/fixup_conversations.php
index 8a9f7bb57..80890fe98 100755
--- a/scripts/fixup_conversations.php
+++ b/scripts/fixup_conversations.php
@@ -24,17 +24,17 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
common_log(LOG_INFO, 'Fixing up conversations.');
-$nid = new Notice();
-$nid->query('select id, reply_to from notice where conversation is null');
+$notice = new Notice();
+$notice->query('select id, reply_to from notice where conversation is null');
-while ($nid->fetch()) {
+while ($notice->fetch()) {
$cid = null;
- $notice = new Notice();
+ $orig = clone($notice);
- if (empty($nid->reply_to)) {
- $cid = $nid->id;
+ if (empty($notice->reply_to)) {
+ $notice->conversation = $notice->id;
} else {
$reply = Notice::staticGet('id', $notice->reply_to);
@@ -61,9 +61,7 @@ while ($nid->fetch()) {
continue;
}
- $notice = null;
$orig = null;
- unset($notice);
unset($orig);
print ".\n";
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 11911dcbd..678ca24c3 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -362,6 +362,10 @@ class MailerDaemon
if (preg_match('/^\s*Sent via/', $line)) {
continue;
}
+ if (preg_match('/^\s*Sent from my/', $line)) {
+ continue;
+ }
+
// skip everything after a sig
if (preg_match('/^\s*--+\s*$/', $line) ||
preg_match('/^\s*__+\s*$/', $line))
diff --git a/scripts/synctwitterfriends.php b/scripts/synctwitterfriends.php
index 2cb7525ea..b30e700a1 100755
--- a/scripts/synctwitterfriends.php
+++ b/scripts/synctwitterfriends.php
@@ -19,8 +19,6 @@
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-define('STATUSNET', true);
-define('LACONICA', true); // compatibility
$shortoptions = 'di::';
$longoptions = array('id::', 'debug');
diff --git a/scripts/twitterqueuehandler.php b/scripts/twitterqueuehandler.php
index 992141f9d..ce4d824d0 100755
--- a/scripts/twitterqueuehandler.php
+++ b/scripts/twitterqueuehandler.php
@@ -19,8 +19,6 @@
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-define('STATUSNET', true);
-define('LACONICA', true); // compatibility
$shortoptions = 'i::';
$longoptions = array('id::');
diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php
index 6dca6f75b..3cdf1867a 100755
--- a/scripts/twitterstatusfetcher.php
+++ b/scripts/twitterstatusfetcher.php
@@ -19,8 +19,6 @@
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
-define('STATUSNET', true);
-define('LACONICA', true); // compatibility
// Tune number of processes and how often to poll Twitter
// XXX: Should these things be in config.php?