summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-09-15 23:31:20 -0400
committerEvan Prodromou <evan@status.net>2010-09-15 23:31:20 -0400
commit670ad53215eaaa40a55a1977b373a62940c50a42 (patch)
tree5030420047361499de6d434d5a9315de4662e212 /scripts
parent1ceb93cce483794582f1a928de27592acb4f89cf (diff)
parentdffec9f223c1e45832d274c34f7bd6624cbf87ea (diff)
Merge branch '0.9.x' into activityexport
Diffstat (limited to 'scripts')
-rw-r--r--scripts/commandline.inc24
-rw-r--r--scripts/importtwitteratom.php24
2 files changed, 24 insertions, 24 deletions
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
index a475e11d0..a29f58844 100644
--- a/scripts/commandline.inc
+++ b/scripts/commandline.inc
@@ -177,3 +177,27 @@ function get_option_value($opt, $alt=null)
return null;
}
+
+function getUser()
+{
+ $user = null;
+
+ if (have_option('i', 'id')) {
+ $id = get_option_value('i', 'id');
+ $user = User::staticGet('id', $id);
+ if (empty($user)) {
+ throw new Exception("Can't find user with id '$id'.");
+ }
+ } else if (have_option('n', 'nickname')) {
+ $nickname = get_option_value('n', 'nickname');
+ $user = User::staticGet('nickname', $nickname);
+ if (empty($user)) {
+ throw new Exception("Can't find user with nickname '$nickname'");
+ }
+ } else {
+ show_help();
+ exit(1);
+ }
+
+ return $user;
+}
diff --git a/scripts/importtwitteratom.php b/scripts/importtwitteratom.php
index c12e3b91a..261dfb1d0 100644
--- a/scripts/importtwitteratom.php
+++ b/scripts/importtwitteratom.php
@@ -36,30 +36,6 @@ END_OF_IMPORTTWITTERATOM_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
-function getUser()
-{
- $user = null;
-
- if (have_option('i', 'id')) {
- $id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
- if (empty($user)) {
- throw new Exception("Can't find user with id '$id'.");
- }
- } else if (have_option('n', 'nickname')) {
- $nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
- if (empty($user)) {
- throw new Exception("Can't find user with nickname '$nickname'");
- }
- } else {
- show_help();
- exit(1);
- }
-
- return $user;
-}
-
function getAtomFeedDocument()
{
$filename = get_option_value('f', 'file');