change scripts to take server and path from commandline

This commit is contained in:
Evan Prodromou 2009-06-20 14:58:47 -07:00
parent 45430d2b3b
commit 198afa0a1d
15 changed files with 109 additions and 33 deletions

View File

@ -67,14 +67,25 @@ function _sn_to_path($sn)
return $p;
}
// try to figure out where we are
// try to figure out where we are. $server and $path
// can be set by including module, else we guess based
// on HTTP info.
$_server = array_key_exists('SERVER_NAME', $_SERVER) ?
if (isset($server)) {
$_server = $server;
} else {
$_server = array_key_exists('SERVER_NAME', $_SERVER) ?
strtolower($_SERVER['SERVER_NAME']) :
null;
$_path = array_key_exists('SCRIPT_NAME', $_SERVER) ?
}
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

View 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/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
#
@ -116,7 +119,6 @@ class EnjitQueueHandler extends QueueHandler
return $code;
}
}
mb_internal_encoding('UTF-8');

View 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/facebookutil.php');
require_once(INSTALLDIR . '/lib/queuehandler.php');

View 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/jabber.php');
require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');

View 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 > 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()
{
}

View 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/omb.php');
require_once(INSTALLDIR . '/lib/queuehandler.php');

View 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');

View 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/jabber.php');
require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');

View 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/mail.php');
require_once(INSTALLDIR . '/lib/queuehandler.php');

View File

@ -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

View 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();

View 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/twitter.php');
require_once(INSTALLDIR . '/lib/queuehandler.php');

View File

@ -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';

View 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/jabber.php');
require_once(INSTALLDIR . '/lib/xmppqueuehandler.php');

View 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/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');