phergie.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Phergie
  5. *
  6. * PHP version 5
  7. *
  8. * LICENSE
  9. *
  10. * This source file is subject to the new BSD license that is bundled
  11. * with this package in the file LICENSE.
  12. * It is also available through the world-wide-web at this URL:
  13. * http://phergie.org/license
  14. *
  15. * @category Phergie
  16. * @package Phergie
  17. * @author Phergie Development Team <team@phergie.org>
  18. * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
  19. * @license http://phergie.org/license New BSD License
  20. * @link http://pear.phergie.org/package/Phergie
  21. */
  22. /**
  23. * @see Phergie_Autoload
  24. */
  25. require 'Phergie/Autoload.php';
  26. Phergie_Autoload::registerAutoloader();
  27. $bot = new Phergie_Bot;
  28. if (!isset($argc)) {
  29. echo
  30. 'The PHP setting register_argc_argv must be enabled for Phergie ',
  31. 'configuration files to be specified using command line arguments; ',
  32. 'defaulting to Settings.php in the current working directory',
  33. PHP_EOL;
  34. } else if ($argc > 0) {
  35. // Skip the current file for manual installations
  36. // ex: php phergie.php Settings.php
  37. if (realpath($argv[0]) == __FILE__) {
  38. array_shift($argv);
  39. }
  40. // If configuration files were specified, override default behavior
  41. if (count($argv) > 0) {
  42. $config = new Phergie_Config;
  43. foreach ($argv as $file) {
  44. $config->read($file);
  45. }
  46. $bot->setConfig($config);
  47. }
  48. }
  49. $bot->run();