]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.8.x' into cmdline
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 22 Jun 2009 21:51:17 +0000 (14:51 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 22 Jun 2009 21:51:17 +0000 (14:51 -0700)
15 files changed:
lib/common.php
scripts/enjitqueuehandler.php
scripts/facebookqueuehandler.php
scripts/jabberqueuehandler.php
scripts/maildaemon.php
scripts/ombqueuehandler.php
scripts/pingqueuehandler.php
scripts/publicqueuehandler.php
scripts/smsqueuehandler.php
scripts/synctwitterfriends.php
scripts/triminboxes.php
scripts/twitterqueuehandler.php
scripts/twitterstatusfetcher.php
scripts/xmppconfirmhandler.php
scripts/xmppdaemon.php

index 0333030e1d8753025a92e46c0cc5bc4fa1e4b121..a8c7634f6231b050a2e4b47421c846f7a3d54723 100644 (file)
@@ -67,14 +67,25 @@ function _sn_to_path($sn)
     return $p;
 }
 
-// try to figure out where we are
-
-$_server = array_key_exists('SERVER_NAME', $_SERVER) ?
-  strtolower($_SERVER['SERVER_NAME']) :
-  null;
-$_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
-  _sn_to_path($_SERVER['SCRIPT_NAME']) :
-  null;
+// try to figure out where we are. $server and $path
+// can be set by including module, else we guess based
+// on HTTP info.
+
+if (isset($server)) {
+    $_server = $server;
+} else {
+    $_server = array_key_exists('SERVER_NAME', $_SERVER) ?
+      strtolower($_SERVER['SERVER_NAME']) :
+    null;
+}
+
+if (isset($path)) {
+    $_path = $path;
+} else {
+    $_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
+      _sn_to_path($_SERVER['SCRIPT_NAME']) :
+    null;
+}
 
 // default configuration, overwritten in config.php
 
index c28bbe01d911de507ad9022d9ccd28efd40f039e..15ab3a4270d969f9bbd13c1ad708124b1feeac6e 100755 (executable)
@@ -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/mail.php');
 require_once(INSTALLDIR . '/lib/queuehandler.php');
@@ -35,7 +40,6 @@ set_error_handler('common_error_handler');
 
 class EnjitQueueHandler extends QueueHandler
 {
-    
     function transport()
     {
         return 'enjit';
@@ -60,7 +64,6 @@ class EnjitQueueHandler extends QueueHandler
                     return "skipped";
                 }
 
-
                 #
                 # Build an Atom message from the notice
                 #
@@ -93,8 +96,8 @@ class EnjitQueueHandler extends QueueHandler
         $ch   = curl_init();
 
         curl_setopt($ch, CURLOPT_URL, $url);
-                curl_setopt($ch, CURLOPT_HEADER, 1); 
+
+                curl_setopt($ch, CURLOPT_HEADER, 1);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_POST, 1) ;
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
@@ -103,7 +106,7 @@ class EnjitQueueHandler extends QueueHandler
                 #
         # curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
         # curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
-                # curl_setopt($ch, CURLOPT_VERBOSE, 1); 
+                # curl_setopt($ch, CURLOPT_VERBOSE, 1);
 
         $result = curl_exec($ch);
 
@@ -115,7 +118,6 @@ class EnjitQueueHandler extends QueueHandler
 
                 return $code;
     }
-    
 
 }
 
index a505e8ecc64c6fd3d68532b0ea0a408d08d42883..f9123db8ce8c7b9ee141b777685a26490469bdb9 100755 (executable)
@@ -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/facebookutil.php');
 require_once(INSTALLDIR . '/lib/queuehandler.php');
@@ -35,12 +40,12 @@ set_error_handler('common_error_handler');
 
 class FacebookQueueHandler extends QueueHandler
 {
-    
+
     function transport()
     {
         return 'facebook';
     }
-    
+
     function start()
     {
         $this->log(LOG_INFO, "INITIALIZE");
@@ -51,7 +56,7 @@ class FacebookQueueHandler extends QueueHandler
     {
         return facebookBroadcastNotice($notice);
     }
-    
+
     function finish()
     {
     }
index 130be6e0475201f84a986ce89cd72940f9ff68b5..b848442fd1d9a39bcc3a8f8f9e03bcd15dfe69f9 100755 (executable)
@@ -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');
index ccc1eef52fecf18fff3218b7e05db77d7b645ee8..dc3ab0b56e746d605c27db3d56fbf188ca184e4a 100755 (executable)
@@ -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 > 1) ? $argv[1] : null;
+$path   = ($argc > 2) ? $argv[2] : null;
+
 require_once(INSTALLDIR . '/lib/common.php');
 require_once(INSTALLDIR . '/lib/mail.php');
 require_once('Mail/mimeDecode.php');
@@ -36,7 +41,6 @@ require_once('Mail/mimeDecode.php');
 
 class MailerDaemon
 {
-
     function __construct()
     {
     }
index 5fe7cf01df1cfa0cd0baf39145e450402eb535aa..4c5890f57c8d5aeb671602b26c4c225ba0539d53 100755 (executable)
@@ -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/omb.php');
 require_once(INSTALLDIR . '/lib/queuehandler.php');
@@ -35,12 +40,12 @@ set_error_handler('common_error_handler');
 
 class OmbQueueHandler extends QueueHandler
 {
-    
+
     function transport()
     {
         return 'omb';
     }
-    
+
     function start()
     {
         $this->log(LOG_INFO, "INITIALIZE");
@@ -56,7 +61,7 @@ class OmbQueueHandler extends QueueHandler
             return omb_broadcast_remote_subscribers($notice);
         }
     }
-    
+
     function finish()
     {
     }
index f57752cd2d2e7bb0c57b130433bd5dd0bcd8f596..84ef9be277de25b8b9cee60a1f0fec45720eeacf 100644 (file)
@@ -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/ping.php');
 require_once(INSTALLDIR . '/lib/queuehandler.php');
index c0452cbee13ad7dd7260538d7825e2a672164147..017174ed8a0b1774ea88675fbfdcd0da2664c699 100755 (executable)
@@ -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');
@@ -35,12 +40,12 @@ set_error_handler('common_error_handler');
 
 class PublicQueueHandler extends XmppQueueHandler
 {
-    
+
     function transport()
     {
         return 'public';
     }
-    
+
     function handle_notice($notice)
     {
         try {
index 631719aa2186aab6f58510ce4a362ee2f40b91e8..0366d4c4ca62d24caf7754934cb74bcaf35ec105 100755 (executable)
@@ -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/mail.php');
 require_once(INSTALLDIR . '/lib/queuehandler.php');
@@ -35,7 +40,7 @@ set_error_handler('common_error_handler');
 
 class SmsQueueHandler extends QueueHandler
 {
-    
+
     function transport()
     {
         return 'sms';
@@ -51,7 +56,7 @@ class SmsQueueHandler extends QueueHandler
     {
         return mail_broadcast_notice_sms($notice);
     }
-    
+
     function finish()
     {
     }
index 8a338f1b4a78a082acc8566c1b796236041a8831..7f418894e68fa505fdd629cf0811c373b799901f 100755 (executable)
@@ -30,6 +30,11 @@ define('LACONICA', true);
 // Uncomment this to get useful console output
 //define('SCRIPT_DEBUG', true);
 
+// Preset the server at the command line
+
+$server = ($argc > 1) ? $argv[1] : null;
+$path   = ($argc > 2) ? $argv[2] : null;
+
 require_once(INSTALLDIR . '/lib/common.php');
 
 // Make a lockfile
index 0d2eaeaf09263e0d3bed6f50110855b38c752e26..0d545b3263f5014c78c4ef75056abb14ff08f182 100644 (file)
@@ -32,6 +32,11 @@ mb_internal_encoding('UTF-8');
 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');
 
 $user = new User();
@@ -74,10 +79,10 @@ while ($user->fetch()) {
     $delay = 3.0 * ($finish - $start);
 
     print "Delaying $delay seconds...";
-    
+
     // Wait to let slaves catch up
 
     usleep($delay * 1000000);
-    
+
     print "DONE.\n";
 }
index 6089b5c7db2a4bbd76d9c79967a432bad406fbf7..d6fb17cc8b3954b632bc71e7b1e4b8db2454f933 100755 (executable)
@@ -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/twitter.php');
 require_once(INSTALLDIR . '/lib/queuehandler.php');
@@ -35,12 +40,12 @@ set_error_handler('common_error_handler');
 
 class TwitterQueueHandler extends QueueHandler
 {
-    
+
     function transport()
     {
         return 'twitter';
     }
-    
+
     function start()
     {
         $this->log(LOG_INFO, "INITIALIZE");
@@ -51,7 +56,7 @@ class TwitterQueueHandler extends QueueHandler
     {
         return broadcast_twitter($notice);
     }
-    
+
     function finish()
     {
     }
index 442435be16692eb23a9427024343a1d0392c2b19..c18261b5b9d28a6e878dfd63d35ee370f9739ee5 100755 (executable)
@@ -33,7 +33,12 @@ define('MAXCHILDREN', 2);
 define('POLL_INTERVAL', 60); // in seconds
 
 // Uncomment this to get useful logging
-define('SCRIPT_DEBUG', true);
+// define('SCRIPT_DEBUG', 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/daemon.php';
index 1fa361a36b8a300c178e0f741675f1db4311bc8e..217481d658827af8758558dd962401fa38f75df1 100755 (executable)
@@ -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');
@@ -39,12 +44,12 @@ class XmppConfirmHandler extends XmppQueueHandler
 {
 
     var $_id = 'confirm';
-    
+
     function class_name()
     {
         return 'XmppConfirmHandler';
     }
-    
+
     function run()
     {
         if (!$this->start()) {
index 528df5d2fc8423fd854f0153d45c2e1780522cac..0f98becdac510860f497b9055c94bb97104e50a9 100755 (executable)
@@ -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/daemon.php');
@@ -39,7 +44,6 @@ set_error_handler('common_error_handler');
 
 class XMPPDaemon extends Daemon
 {
-
     function XMPPDaemon($resource=null)
     {
         static $attrs = array('server', 'port', 'user', 'password', 'host');