summaryrefslogtreecommitdiff
path: root/plugins/Irc/extlib/phergie/phergie.php
blob: f0b9f6ced5e997b760d0910e74e0bc6c67598e98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env php
<?php
/**
 * Phergie 
 *
 * PHP version 5
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.
 * It is also available through the world-wide-web at this URL:
 * http://phergie.org/license
 *
 * @category  Phergie
 * @package   Phergie
 * @author    Phergie Development Team <team@phergie.org>
 * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
 * @license   http://phergie.org/license New BSD License
 * @link      http://pear.phergie.org/package/Phergie
 */

/**
 * @see Phergie_Autoload
 */
require 'Phergie/Autoload.php';
Phergie_Autoload::registerAutoloader();

$bot = new Phergie_Bot;

if (!isset($argc)) {
    echo
        'The PHP setting register_argc_argv must be enabled for Phergie ', 
        'configuration files to be specified using command line arguments; ',
        'defaulting to Settings.php in the current working directory',
        PHP_EOL;
} else if ($argc > 0) {
    // Skip the current file for manual installations
    // ex: php phergie.php Settings.php
    if (realpath($argv[0]) == __FILE__) {
        array_shift($argv);
    }

    // If configuration files were specified, override default behavior
    if (count($argv) > 0) {
        $config = new Phergie_Config;
        foreach ($argv as $file) {
            $config->read($file);
        }
        $bot->setConfig($config);
    }
}

$bot->run();