X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=scripts%2Fsmsqueuehandler.php;h=6583a77da85fa898950c40bad4d25bf56898084e;hb=982850c9c75eb2eb9821ae1e3ce76594ffdf4b7e;hp=b75efe4edb934806adea51040b7e46d16a0dfcac;hpb=dbf28603fab3824fbaa4afc52c3f8d32f31b5041;p=quix0rs-gnu-social.git diff --git a/scripts/smsqueuehandler.php b/scripts/smsqueuehandler.php index b75efe4edb..6583a77da8 100755 --- a/scripts/smsqueuehandler.php +++ b/scripts/smsqueuehandler.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/omb.php'); -require_once(INSTALLDIR . '/lib/queuehandler.php'); +$shortoptions = 'i::'; +$longoptions = array('id::'); -set_error_handler('common_error_handler'); +$helptext = << 1) ? $argv[1] : NULL; +class SmsQueueHandler extends QueueHandler +{ + function transport() + { + return 'sms'; + } -$handler = new SmsQueueHandler($id); + function start() + { + $this->log(LOG_INFO, "INITIALIZE"); + return true; + } + + function handle_notice($notice) + { + return mail_broadcast_notice_sms($notice); + } -if ($handler->start()) { - $handler->handle_queue(); + function finish() + { + } } -$handler->finish(); +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 SmsQueueHandler($id); + +$handler->runOnce();