]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.8.x' into cmdline
authorEvan Prodromou <evan@controlyourself.ca>
Sat, 20 Jun 2009 22:51:51 +0000 (15:51 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Sat, 20 Jun 2009 22:51:51 +0000 (15: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 702da823516dc8f828d9d25496cc78e710970f67..17eed71cdbea165774769e6272ad3bcdb26193ab 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 40f60da5d80996fc19901c61546fc91be72e57ba..37fef0b04d794c67b504fb47c4326d08bd133191 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 c6859cb219121f10b4885b277f94702ed7005a9b..c24a22596400172493ed75a876fd4364f2300a7d 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 8b6e974c0aa7af3a87cca507ccfbf10f4d6b1920..454c67f7be497f3c06c38765fd0d79032a063b71 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 9dd647bf46c22841ea8b6a7fe2dd0d68c63ede12..0b9ab0debaf74f700fede997842c2d3999c79b0a 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 cdcea51dc737d1e6eaa9ab884aaa2779e9c50ae6..6abc6d7f1e2c768e96c7fa492c516b9d006dc3af 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 ada6ecdba2070f20ad9a865553fdca2543df15ec..372c550f5d8bb0f8f75030ab28ad56af89e5c1ba 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 b0fa22d438e6a66c0c3931e33965a739e4afe087..7e09454d1ae8a78354477ae6e7401cce651aef28 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 38f2f11febb4e6f812da9eb8f65d7a75348c481e..ed6dbd2ad317381bf5d5a46745471ef1bb64bd72 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 bd08ba58d6a9bcba0e1bcfd3af3941f4aaa461d5..dea3f97006be7b5e5418e86cedf0deaf2804c33c 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 7da4f1e20aa1fc2f0e6fe8fc3d1ef13a12ec5792..8c8a59d6a92bb962f7da24181b03654cf88323fc 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 20f42cef853e6feab9565d5fbbf5b8e5a284ebdf..2863207b0a393c2e8908176ff5e4ca6f1fcd1563 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 7f39235fed8464f7e3847990c3976d75e7bd05b8..fee902320c7dc856ae4d6991cd70c628ac311732 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 b79fa1b3ba0145101e167ddafea80fdd67ca3fc8..468a163d2755ba7d413715c8ede9387e5fcfa735 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');