Remove Horde_Cli::singleton().
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 11 Feb 2010 19:50:38 +0000 (12:50 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 11 Feb 2010 19:58:30 +0000 (12:58 -0700)
If calling appInit() with 'cli' parameter set to true, the global
variable $cli will contain the Horde_Cli instance.

60 files changed:
agora/scripts/phorum2agora.php
agora/scripts/upgrades/2007-09-23_last_message.php
ansel/scripts/all_images_exif_to_tags.php
ansel/scripts/ansel.php
ansel/scripts/recursive_import.php
ansel/scripts/remote_import.php
ansel/scripts/upgrades/1.0_to_1.1.php
ansel/scripts/upgrades/2008-09-16_add_original_date_values.php
ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php
ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php
beatnik/scripts/export_config.php
folks/scripts/activity.php
folks/scripts/mail-filter.php
folks/scripts/mail.php
folks/scripts/popularity.php
framework/Auth/lib/Horde/Auth.php
framework/Cli/doc/Horde/Cli/colors.php
framework/Cli/lib/Horde/Cli.php
framework/Core/lib/Horde/Registry.php
framework/Memcache/scripts/Horde/Memcache/stats.php
framework/Reflection/lib/Horde/Reflection/Cli.php
framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php
framework/admintools/horde-create-sequence.php
framework/admintools/horde-remove-pref.php
framework/bin/install_framework
framework/devtools/horde-check-themes.php
framework/iCalendar/docs/examples/parser.php
horde/bin/db_migrate
horde/scripts/import_squirrelmail_file_prefs.php
horde/scripts/import_squirrelmail_sql_prefs.php
horde/scripts/upgrades/2008-04-09_horde_syncml_map.php
horde/scripts/upgrades/2008-08-29_fix_mdb2_sequences.php
horde/scripts/upgrades/migrate_user_categories.php
horde/scripts/upgrades/move_history_out_of_datatree.php
hylax/scripts/fax_create_recv.php
hylax/scripts/fax_save_data.php
hylax/scripts/fax_save_recv_data.php
imp/scripts/query-imap-cache.php
ingo/scripts/upgrades/convert_datatree_shares_to_sql.php
ingo/scripts/upgrades/convert_prefs_to_sql.php
koward/script/Koward/koward.php
kronolith/scripts/import_squirrelmail_calendar.php
kronolith/scripts/upgrades/convert_datatree_shares_to_sql.php
kronolith/scripts/upgrades/convert_to_utc.php
nag/scripts/import_vtodos.php
nag/scripts/upgrades/convert_datatree_shares_to_sql.php
nag/scripts/upgrades/create_missing_add_histories_sql.php
turba/scripts/import_squirrelmail_file_abook.php
turba/scripts/import_squirrelmail_sql_abook.php
turba/scripts/import_vcards.php
turba/scripts/upgrades/2.1_to_2.2_sql_schema.php
turba/scripts/upgrades/convert_datatree_shares_to_sql.php
turba/scripts/upgrades/public_to_horde_share.php
whups/scripts/bugzilla-import.php
whups/scripts/mail-filter.php
whups/scripts/obliterate.php
whups/scripts/upgrades/convert_datatree_shares_to_sql.php
wicked/scripts/mail-filter.php
wicked/scripts/upgrades/convert_to_utf8.php
wicked/scripts/wicked.php

index f96eb97..29b408c 100755 (executable)
@@ -17,7 +17,6 @@
 
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Open Agora database. */
 $db_agora = &DB::connect($conf['sql']);
index b4f002f..35c1d18 100644 (file)
@@ -6,7 +6,6 @@
 
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('agora', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Open the database. */
 $params = Horde::getDriverConfig('storage', 'sql');
index 747f767..2664075 100755 (executable)
@@ -16,7 +16,6 @@ Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true
 $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'hu:p:f:',
                               array('help', 'username=', 'password=', 'fields='));
 
-$cli = Horde_Cli::singleton();
 if (is_a($ret, 'PEAR_Error')) {
     $cli->fatal($ret->getMessage());
 }
index 291f192..3e20cb6 100755 (executable)
@@ -11,7 +11,6 @@
 
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 // We accept the user name on the command-line.
 $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(),
index e024518..598db2a 100755 (executable)
@@ -11,7 +11,6 @@
 
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 // We accept the user name on the command-line.
 $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'hu:p:lc:g:a:d:k',
index e64acb9..d942112 100755 (executable)
@@ -14,7 +14,6 @@
 
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Command line options */
 $ret = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'hu:p:g:s:d:kr:zl',
index 2c7fdf2..43b86ae 100644 (file)
@@ -11,7 +11,6 @@
 
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_CLI::singleton();
 
 // First update the tables
 $alter = array("ALTER TABLE ansel_images ADD COLUMN image_latitude VARCHAR(32) NOT NULL DEFAULT ''",
index 56d276a..2f64db1 100755 (executable)
@@ -13,7 +13,6 @@
 
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 $sql = 'SELECT image_id, image_original_date, image_uploaded_date FROM ansel_images';
 $results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
index ed96e42..77caf72 100755 (executable)
@@ -11,7 +11,6 @@
 
 require_once dirname(__FILE__) . '/../../Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 $sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
 $results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
index 72e753a..638d999 100644 (file)
@@ -11,7 +11,6 @@
 
 require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 $sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
 $results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
index 3baa394..5a4a018 100644 (file)
@@ -30,8 +30,7 @@ if (!Horde_CLI::runningFromCLI()) {
 }
 
 // Load the CLI environment.
-Horde_CLI::init();
-$cli = &Horde_CLI::singleton();
+$cli = Horde_Cli::init();
 
 // We accept the user name on the command-line.
 require_once 'Console/Getopt.php';
index 1a38f62..b2599d0 100644 (file)
@@ -24,8 +24,7 @@ if (!Horde_Cli::runningFromCLI()) {
 }
 
 // Load the CLI environment.
-Horde_Cli::init();
-$cli = &Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 $db = DB::connect($conf['sql']);
 if ($db instanceof PEAR_Error) {
index fafe821..838348d 100644 (file)
@@ -47,8 +47,7 @@ if (!Horde_Cli::runningFromCLI()) {
 
 // Load the CLI environment - make sure there's no time limit, init some
 // variables, etc.
-Horde_Cli::init();
-$cli = Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 $horde_authentication = 'none';
 require_once dirname(__FILE__) . '/../lib/base.php';
index e4565b0..580eea5 100644 (file)
@@ -20,8 +20,7 @@ if (!Horde_Cli::runningFromCLI()) {
 }
 
 // Load the CLI environment.
-Horde_Cli::init();
-$cli = Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 // Load Folks.
 $folks_authentication = 'none';
index 0e9c4df..c3bef3f 100644 (file)
@@ -24,8 +24,7 @@ if (!Horde_Cli::runningFromCLI()) {
 }
 
 // Load the CLI environment.
-Horde_Cli::init();
-$cli = Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 $db = DB::connect($conf['sql']);
 if ($db instanceof PEAR_Error) {
index 9bccffe..85eadb9 100644 (file)
@@ -492,7 +492,7 @@ class Horde_Auth
     static public function authenticateFailure($app = 'horde', $e = null)
     {
         if (Horde_Cli::runningFromCLI()) {
-            $cli = Horde_Cli::singleton();
+            $cli = new Horde_Cli();
             $cli->fatal(_("You are not authenticated."));
         }
 
index c7fc4ed..f3248a5 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 require 'Horde/Cli.php';
-$cli = Horde_Cli::singleton();
+$cli = new Horde_Cli();
 
 /* Explicit colors */
 $cli->writeln($cli->red('Red'));
index faebeb9..3837e47 100644 (file)
 class Horde_Cli
 {
     /**
-     * Singleton instance
-     *
-     * @var Horde_Cli
-     */
-    static protected $_instance;
-
-    /**
      * Are we running on a console?
      *
      * @var boolean
@@ -126,24 +119,10 @@ class Horde_Cli
     );
 
     /**
-     * Returns a single instance of the Horde_Cli class.
-     */
-    static public function singleton()
-    {
-        if (!isset(self::$_instance)) {
-            self::$_instance = new self();
-        }
-
-        return self::$_instance;
-    }
-
-    /**
      * Detect the current environment (web server or console) and sets
      * internal values accordingly.
      *
-     * The constructor must not be called after init(). Either use the
-     * singleton() method to retrieve a Horde_Cli object, or don't call init()
-     * statically.
+     * The constructor must not be called after init().
      */
     public function __construct()
     {
@@ -444,12 +423,14 @@ class Horde_Cli
      * You must not call init() statically before calling the constructor.
      * Either use the singleton() method to retrieve a Horde_Cli object after
      * calling init(), or don't call init() statically.
+     *
+     * @return Horde_Cli  A Horde_Cli instance.
      */
     static public function init()
     {
         /* Run constructor now because it requires $_SERVER['SERVER_NAME'] to
          * be empty if called with a CGI SAPI. */
-        $cli = self::singleton();
+        $cli = new self();
 
         @set_time_limit(0);
         ob_implicit_flush(true);
@@ -468,6 +449,8 @@ class Horde_Cli
         if (!defined('STDERR')) {
             define('STDERR', fopen('php://stderr', 'r'));
         }
+
+        return $cli;
     }
 
     /**
index 6bd63a6..f261ac8 100644 (file)
@@ -92,7 +92,8 @@ class Horde_Registry
      * init() will be called after the initialization is completed.
      *
      * Global variables defined:
-     *   $registry - Registry object
+     *   $cli - Horde_Cli object (if 'cli' is true)
+     *   $registry - Horde_Registry object
      *
      * @param string $app  The application to initialize.
      * @param array $args  Optional arguments:
@@ -149,7 +150,7 @@ class Horde_Registry
 
             /* Load the CLI environment - make sure there's no time limit,
              * init some variables, etc. */
-            Horde_Cli::init();
+            $GLOBALS['cli'] = Horde_Cli::init();
 
             $args['nocompress'] = true;
         }
index f1cc527..81887d9 100755 (executable)
@@ -21,7 +21,6 @@ $horde_base = '/path/to/horde';
 
 require_once $horde_base . '/lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Make sure there's no compression. */
 @ob_end_clean();
index 68a00e0..0a39d5d 100644 (file)
@@ -29,8 +29,7 @@ class Horde_Reflection_CLI extends Horde_Reflection {
      */
     public function __construct(ReflectionFunction $method)
     {
-        Horde_Cli::init();
-        $this->_cli = Horde_Cli::singleton();
+        $this->_cli = Horde_Cli::init();
 
         parent::__construct($method);
     }
index 08306fc..a8ff63a 100755 (executable)
@@ -15,7 +15,6 @@ $horde_base = '/path/to/horde';
 
 require_once $horde_base . '/lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Check for sessionhandler object. */
 $registry->setupSessionHandler();
index 4d2cb58..c77f6a2 100755 (executable)
@@ -13,7 +13,6 @@
 require_once dirname(__FILE__) . '/horde-base.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
 $db_lib = 'DB';
 $sequence = null;
 
index 7353516..0ff09c8 100755 (executable)
@@ -15,7 +15,6 @@ $live = false;
 
 require_once dirname(__FILE__) . '/horde-base.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true, 'nocompress' => true));
-$cli = Horde_Cli::singleton();
 
 $scope = $cli->prompt(_("Enter value for pref_scope:"));
 $name = $cli->prompt(_("Enter value for pref_name:"));
index cb20439..ce1502e 100755 (executable)
@@ -125,7 +125,7 @@ if (!Horde_Cli::runningFromCLI()) {
 
 // Load the CLI environment - make sure there's no time limit, init
 // some variables, etc.
-Horde_Cli::init();
+$GLOBALS['cli'] = Horde_Cli::init();
 
 if (!class_exists('SimpleXMLElement', false)) {
     include_once 'Tree/Tree.php';
@@ -195,7 +195,7 @@ class Linker {
     {
         $this->_srcDir = $srcDir;
         $packageFile = $this->_srcDir . '/package.xml';
-        $cli = &Horde_Cli::singleton();
+        $cli = $GLOBALS['cli'];
 
         if (!is_file($packageFile)) {
             $cli->message('No package.xml in ' . $this->_srcDir, 'cli.warning');
@@ -251,8 +251,7 @@ class Linker {
                     break;
 
                 default:
-                    $cli = &Horde_Cli::singleton();
-                    $cli->message('No handler for tag: ' . $child['name'], 'cli-warning');
+                    $GLOBALS['cli']->message('No handler for tag: ' . $child['name'], 'cli-warning');
                     break;
                 }
             }
@@ -273,8 +272,7 @@ class Linker {
                     break;
 
                 default:
-                    $cli = &Horde_Cli::singleton();
-                    $cli->message('No handler for tag: ' . $child['name'], 'cli-warning');
+                    $GLOBALS['cli']->message('No handler for tag: ' . $child['name'], 'cli-warning');
                     break;
                 }
             }
index 853982c..0ee34f0 100755 (executable)
@@ -49,8 +49,7 @@ if ($horde_base === null) {
 }
 
 /* Set up CLI. */
-$cli = Horde_Cli::singleton();
-$cli->init();
+$cli = Horde_Cli::init();
 
 $horde_authentication = 'none';
 require_once $horde_base . '/lib/base.php';
index 07efe99..ee4ab1f 100755 (executable)
@@ -18,8 +18,7 @@ if (!Horde_Cli::runningFromCLI()) {
 
 // Load the CLI environment - make sure there's no time limit, init
 // some variables, etc.
-Horde_Cli::init();
-$cli = &Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 if (empty($argv[1])) {
     $cli->fatal('No file specified on the command line.');
index 3f9f514..1a3ff53 100755 (executable)
@@ -11,7 +11,6 @@
 
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 // Get a database connection
 $db = $GLOBALS['injector']->getInstance('Horde_Db_Adapter_Base');
index 8b325f4..db75dd7 100755 (executable)
@@ -20,7 +20,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if ($argc != 2) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     $cli->writeln('Usage: import_squirrelmail_prefs.php path-to-squirrelmail-data');
index b42dffb..c6c3b4a 100755 (executable)
@@ -20,7 +20,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if ($argc != 2) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     $cli->writeln('Usage: import_squirrelmail_prefs.php DSN');
index 42a3a43..2a1e631 100755 (executable)
@@ -7,7 +7,6 @@
 
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 require_once 'Horde/DataTree.php';
 $datatree = DataTree::factory('sql',
index 661c462..a542385 100755 (executable)
@@ -25,7 +25,6 @@ $to_upgrade = array('ansel_shares' => 'share_id',
 /* Set up the CLI environment */
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 $config = $GLOBALS['conf']['sql'];
 unset($config['charset']);
index d0d5b6c..c5bb4a6 100755 (executable)
@@ -11,7 +11,6 @@
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
 $cManager = new Horde_Prefs_CategoryManager();
 $apps = $registry->listApps(array('hidden', 'notoolbar', 'active', 'admin'));
 
index 54a662c..9a1ade8 100755 (executable)
@@ -8,7 +8,6 @@
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
 $cli->writeln($cli->yellow("Beginning migration. This may take a very long time to complete."));
 $cli->writeln();
 
index 3fa18da..f4fcaba 100755 (executable)
@@ -19,7 +19,6 @@ if (isset($args[2])) {
     $info['job_id'] = (int)substr($file, 9, -4);
 }
 
-$cli = Horde_Cli::singleton();
 $fax_info = $cli->readStdin();
 $fax_info = explode("\n", $fax_info);
 foreach ($fax_info as $line) {
index 35f87b0..a0d6a59 100755 (executable)
@@ -5,7 +5,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 $hylax = Horde_Registry::appInit('hylax', array('authentication' => 'none', 'cli' => true));
 
 /* Store the raw fax postscript data. */
-$cli = Horde_Cli::singleton();
 $data = $cli->readStdin();
 if (empty($data)) {
     Horde::logMessage('No print data received from standard input. Exiting fax submission.', __FILE__, __LINE__, PEAR_LOG_ERR);
index 4615aa1..f8d90c0 100755 (executable)
@@ -13,7 +13,6 @@ if (isset($args[1])) {
 }
 
 /* Store the raw fax postscript data. */
-$cli = Horde_Cli::singleton();
 $data = $cli->readStdin();
 if (empty($data)) {
     Horde::logMessage('No print data received from standard input. Exiting fax submission.', __FILE__, __LINE__, PEAR_LOG_ERR);
index 7f4f7e0..4557d3c 100755 (executable)
@@ -15,8 +15,6 @@
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('imp', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
-
 $c = new Console_Getopt();
 $argv = $c->readPHPArgv();
 array_shift($argv);
index 398a7b1..0a10317 100755 (executable)
@@ -9,7 +9,6 @@
 /* Set up the CLI environment */
 require_once dirname(__FILE__) . '/../../../lib/Application.php';
 Horde_Registry::appInit('ingo', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 $config = $GLOBALS['conf']['sql'];
 unset($config['charset']);
index 84f7d33..090eff4 100755 (executable)
@@ -20,7 +20,6 @@
 
 require_once dirname(__FILE__) . '/../../../lib/Application.php';
 Horde_Registry::appInit('ingo', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Initialize storage backends. */
 if ($conf['storage']['driver'] != 'sql') {
index 61ce3e2..8b1e0c0 100644 (file)
@@ -31,8 +31,7 @@ if (!$opts->base) {
  * Ensure that the base parameters (especially SERVER_NAME) get set for the
  * command line.
  */
-$cli = Horde_Cli::singleton();
-$cli->init();
+$cli = Horde_Cli::init();
 
 /**
  * Hm, the fact that we need the registry at this point for
index adace66..1bd3f39 100755 (executable)
@@ -19,7 +19,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true, 'user_admin' => true));
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if ($argc != 2) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     $cli->writeln('Usage: import_squirrelmail_file_abook.php DSN');
index a92d769..01df788 100755 (executable)
@@ -10,8 +10,6 @@
 require_once dirname(__FILE__) . '/../../Application.php';
 Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
-
 $config = $GLOBALS['conf']['sql'];
 unset($config['charset']);
 $db = MDB2::factory($config);
index ddd276e..db08b94 100755 (executable)
@@ -15,7 +15,6 @@ $result = $db->query('SELECT event_title, event_id, event_creator_id, event_star
 $stmt = $db->prepare('UPDATE kronolith_events SET event_start = ?, event_end = ?, event_recurenddate = ? WHERE event_id = ?');
 
 /* Confirm changes. */
-$cli = Horde_Cli::singleton();
 if (!isset($argv[1]) || $argv[1] != '--yes') {
     $answer = $cli->prompt('Running this script will convert all existing events to UTC. This conversion is not reversible. Is this what you want?', array('y' => 'Yes', 'n' => 'No'));
     if ($answer != 'y') {
index 28b41de..0ddcbc1 100755 (executable)
@@ -17,7 +17,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if (count($argv) != 3) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     usage();
index 9460d8d..b66e250 100755 (executable)
@@ -9,8 +9,6 @@
 /* Set up the CLI environment */
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
-
 /* Grab what we need to steal the DB config */
 require_once HORDE_BASE . '/config/conf.php';
 
index 9cb7cfa..45a13fd 100755 (executable)
@@ -13,7 +13,6 @@
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
 $history = Horde_History::singleton();
 
 // Run through every tasklist.
index 54c3eb0..0ed0a9b 100755 (executable)
@@ -23,7 +23,6 @@ Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true
 require_once TURBA_BASE . '/lib/Object/Group.php';
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if ($argc != 2) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     $cli->writeln('Usage: import_squirrelmail_file_abook.php path-to-squirrelmail-data');
index 19be83e..77e1ac0 100755 (executable)
@@ -22,7 +22,6 @@ Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true
 require_once TURBA_BASE . '/lib/Object/Group.php';
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if ($argc != 2) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     $cli->writeln('Usage: import_squirrelmail_file_abook.php DSN');
index bb47c35..c7fc44d 100755 (executable)
@@ -18,7 +18,6 @@ require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
 
 // Read command line parameters.
-$cli = Horde_Cli::singleton();
 if (count($argv) != 3) {
     $cli->message('Too many or too few parameters.', 'cli.error');
     usage();
index bcbc64f..dba6aa2 100755 (executable)
@@ -36,7 +36,6 @@ $do_email = true;
 /* Set up the CLI environment */
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Grab what we need to steal the DB config */
 require_once HORDE_BASE . '/config/conf.php';
index a69e27c..7736496 100755 (executable)
@@ -10,7 +10,6 @@
 /* Set up the CLI environment */
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true));
-$cli = Horde_Cli::singleton();
 
 /* Grab what we need to steal the DB config */
 require_once HORDE_BASE . '/config/conf.php';
index 1e35d2a..f185480 100755 (executable)
@@ -21,7 +21,6 @@
 // Load Horde and Turba enviroments
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('turba', array('authentication' => 'none', 'cli' => true, 'user_admin' => true));
-$CLI = Horde_Cli::singleton();
 
 $CLI->writeln('This script will turn all entries in the SQL address book into a globally shared address book.');
 $CLI->writeln('Make sure you read the script comments and be sure you know what you are doing.');
index a5b1fd1..1b31377 100755 (executable)
@@ -30,8 +30,7 @@ if (!Horde_Cli::runningFromCLI()) {
 }
 
 /* Load the command line environment. */
-Horde_Cli::init();
-$cli =& Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 /* Load the Whups libraries. */
 require_once HORDE_BASE . '/lib/core.php';
index dc1ed83..34284bd 100755 (executable)
@@ -59,8 +59,6 @@ function _dump($hash)
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('whups', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
-
 // Set server name.
 $conf['server']['name'] = $conf['mail']['server_name'];
 $conf['server']['port'] = $conf['mail']['server_port'];
index 4c7c9d1..88e5fd0 100755 (executable)
@@ -22,8 +22,7 @@ if (!Horde_Cli::runningFromCLI()) {
 }
 
 /* Load the command line environment. */
-Horde_Cli::init();
-$cli = &Horde_Cli::singleton();
+$cli = Horde_Cli::init();
 
 $confirm = $cli->prompt('Are you sure you want to obliterate all Whups data?',
                         array('n' => 'No', 'y' => 'Yes'));
index b230960..143e848 100755 (executable)
@@ -15,8 +15,7 @@ require_once HORDE_BASE . '/lib/core.php';
 if (!Horde_Cli::runningFromCli()) {
     exit("Must be run from the command line\n");
 }
-$cli = &Horde_Cli::singleton();
-$cli->init();
+$cli = Horde_Cli::init();
 
 /* Grab what we need to steal the DB config */
 require_once HORDE_BASE . '/config/conf.php';
index a2a3c49..0903d7f 100755 (executable)
@@ -9,7 +9,6 @@
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('wicked', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
 $dateFormat = "F j, Y";
 $keepHeaders = array('From', 'To', 'Subject', 'Cc', 'Date');
 
index 42ea33b..47b5ddd 100755 (executable)
@@ -15,8 +15,6 @@
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('wicked', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
-
 // Create driver instance.
 if ($conf['storage']['driver'] != 'sql') {
     exit("You must have an SQL backend configured.\n");
index f75c9d1..d0aa069 100755 (executable)
@@ -12,7 +12,6 @@
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('wicked', array('authentication' => 'none', 'cli' => true));
 
-$cli = Horde_Cli::singleton();
 $debug = false;
 $out = 'screen';