]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/getvaliddaemons.php
Make queuing and daemons work via events
[quix0rs-gnu-social.git] / scripts / getvaliddaemons.php
index 0996ba9f415da150bc3b076c1c44b929d76d762a..7caea1bb759f119ce6a84043dc6d7ed8a67fa83d 100755 (executable)
@@ -1,8 +1,8 @@
 #!/usr/bin/env php
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * StatusNet - the 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
  * daemon names.
  */
 
-# 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');
+$helptext = <<<ENDOFHELP
+getvaliddaemons.php - print out a list of valid daemons that should be started
+by the startdaemons script
+
+ENDOFHELP;
+
+require_once INSTALLDIR.'/scripts/commandline.inc';
+
+$daemons = array();
+
+$daemons[] = INSTALLDIR.'/scripts/pluginqueuehandler.php';
+$daemons[] = INSTALLDIR.'/scripts/ombqueuehandler.php';
+$daemons[] = INSTALLDIR.'/scripts/facebookqueuehandler.php';
+$daemons[] = INSTALLDIR.'/scripts/pingqueuehandler.php';
 
 if(common_config('xmpp','enabled')) {
-    echo "xmppdaemon.php jabberqueuehandler.php publicqueuehandler.php ";
-    echo "xmppconfirmhandler.php ";
+    $daemons[] = INSTALLDIR.'/scripts/xmppdaemon.php';
+    $daemons[] = INSTALLDIR.'/scripts/jabberqueuehandler.php';
+    $daemons[] = INSTALLDIR.'/scripts/publicqueuehandler.php';
+    $daemons[] = INSTALLDIR.'/scripts/xmppconfirmhandler.php';
+}
+
+if (common_config('sms', 'enabled')) {
+    $daemons[] = INSTALLDIR.'/scripts/smsqueuehandler.php';
+}
+
+if (Event::handle('GetValidDaemons', array(&$daemons))) {
+    foreach ($daemons as $daemon) {
+        print $daemon . ' ';
+    }
+    print "\n";
 }
-echo "ombqueuehandler.php ";
-echo "twitterqueuehandler.php ";
-echo "facebookqueuehandler.php ";
-echo "pingqueuehandler.php ";
-echo "smsqueuehandler.php ";