X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Ftwitterqueuehandler.php;h=ce4d824d0d31938f3445a9058e2706004be89419;hb=a5ed805aeabab3930d066b2777dbab9663bc487f;hp=7da4f1e20aa1fc2f0e6fe8fc3d1ef13a12ec5792;hpb=61940e37ff89710628eff1a4ad6db8df16142cec;p=quix0rs-gnu-social.git diff --git a/scripts/twitterqueuehandler.php b/scripts/twitterqueuehandler.php index 7da4f1e20a..ce4d824d0d 100755 --- a/scripts/twitterqueuehandler.php +++ b/scripts/twitterqueuehandler.php @@ -1,8 +1,8 @@ #!/usr/bin/env php . */ -# Abort if called from a web server -if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { - print "This script must be run from the command line\n"; - exit(); -} - define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -define('LACONICA', true); -require_once(INSTALLDIR . '/lib/common.php'); -require_once(INSTALLDIR . '/lib/twitter.php'); -require_once(INSTALLDIR . '/lib/queuehandler.php'); +$shortoptions = 'i::'; +$longoptions = array('id::'); + +$helptext = <<log(LOG_INFO, "INITIALIZE"); @@ -51,20 +52,22 @@ class TwitterQueueHandler extends QueueHandler { return broadcast_twitter($notice); } - + function finish() { } } -ini_set("max_execution_time", "0"); -ini_set("max_input_time", "0"); -set_time_limit(0); - -mb_internal_encoding('UTF-8'); - -$id = ($argc > 1) ? $argv[1] : null; +if (have_option('i')) { + $id = get_option_value('i'); +} else if (have_option('--id')) { + $id = get_option_value('--id'); +} else if (count($args) > 0) { + $id = $args[0]; +} else { + $id = null; +} $handler = new TwitterQueueHandler($id);