]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/jabberqueuehandler.php
Merge branch '0.8.x' into cmdline
[quix0rs-gnu-social.git] / scripts / jabberqueuehandler.php
index 924fc45453ecc2ef08d5b570962c38d27ab6d839..b848442fd1d9a39bcc3a8f8f9e03bcd15dfe69f9 100755 (executable)
@@ -2,7 +2,7 @@
 <?php
 /*
  * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * Copyright (C) 2008, 2009, Control Yourself, 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
@@ -27,6 +27,11 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 define('LACONICA', true);
 
+// Preset the server at the command line
+
+$server = ($argc > 2) ? $argv[2] : null;
+$path   = ($argc > 3) ? $argv[3] : null;
+
 require_once(INSTALLDIR . '/lib/common.php');
 require_once(INSTALLDIR . '/lib/jabber.php');
 require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');
@@ -54,6 +59,13 @@ class JabberQueueHandler extends XmppQueueHandler
     }
 }
 
+// Abort immediately if xmpp is not enabled, otherwise the daemon chews up
+// lots of CPU trying to connect to unconfigured servers
+if (common_config('xmpp','enabled')==false) {
+    print "Aborting daemon - xmpp is disabled\n";
+    exit();
+}
+
 ini_set("max_execution_time", "0");
 ini_set("max_input_time", "0");
 set_time_limit(0);
@@ -63,4 +75,4 @@ $resource = ($argc > 1) ? $argv[1] : (common_config('xmpp','resource') . '-queue
 
 $handler = new JabberQueueHandler($resource);
 
-$handler->runOnce();
\ No newline at end of file
+$handler->runOnce();