From 54a26e22e01a369372381a50d79eb655339c0956 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 11 Feb 2010 12:50:38 -0700 Subject: [PATCH] Remove Horde_Cli::singleton(). If calling appInit() with 'cli' parameter set to true, the global variable $cli will contain the Horde_Cli instance. --- agora/scripts/phorum2agora.php | 1 - agora/scripts/upgrades/2007-09-23_last_message.php | 1 - ansel/scripts/all_images_exif_to_tags.php | 1 - ansel/scripts/ansel.php | 1 - ansel/scripts/recursive_import.php | 1 - ansel/scripts/remote_import.php | 1 - ansel/scripts/upgrades/1.0_to_1.1.php | 1 - .../2008-09-16_add_original_date_values.php | 1 - .../upgrades/2009-06-14_fix_geolocation_values.php | 1 - .../2009-06-22_move_geolocation_values.php | 1 - beatnik/scripts/export_config.php | 3 +-- folks/scripts/activity.php | 3 +-- folks/scripts/mail-filter.php | 3 +-- folks/scripts/mail.php | 3 +-- folks/scripts/popularity.php | 3 +-- framework/Auth/lib/Horde/Auth.php | 2 +- framework/Cli/doc/Horde/Cli/colors.php | 2 +- framework/Cli/lib/Horde/Cli.php | 29 +++++----------------- framework/Core/lib/Horde/Registry.php | 5 ++-- .../Memcache/scripts/Horde/Memcache/stats.php | 1 - framework/Reflection/lib/Horde/Reflection/Cli.php | 3 +-- .../Horde/SessionHandler/horde-active-sessions.php | 1 - framework/admintools/horde-create-sequence.php | 1 - framework/admintools/horde-remove-pref.php | 1 - framework/bin/install_framework | 10 +++----- framework/devtools/horde-check-themes.php | 3 +-- framework/iCalendar/docs/examples/parser.php | 3 +-- horde/bin/db_migrate | 1 - horde/scripts/import_squirrelmail_file_prefs.php | 1 - horde/scripts/import_squirrelmail_sql_prefs.php | 1 - .../upgrades/2008-04-09_horde_syncml_map.php | 1 - .../upgrades/2008-08-29_fix_mdb2_sequences.php | 1 - horde/scripts/upgrades/migrate_user_categories.php | 1 - .../upgrades/move_history_out_of_datatree.php | 1 - hylax/scripts/fax_create_recv.php | 1 - hylax/scripts/fax_save_data.php | 1 - hylax/scripts/fax_save_recv_data.php | 1 - imp/scripts/query-imap-cache.php | 2 -- .../upgrades/convert_datatree_shares_to_sql.php | 1 - ingo/scripts/upgrades/convert_prefs_to_sql.php | 1 - koward/script/Koward/koward.php | 3 +-- kronolith/scripts/import_squirrelmail_calendar.php | 1 - .../upgrades/convert_datatree_shares_to_sql.php | 2 -- kronolith/scripts/upgrades/convert_to_utc.php | 1 - nag/scripts/import_vtodos.php | 1 - .../upgrades/convert_datatree_shares_to_sql.php | 2 -- .../upgrades/create_missing_add_histories_sql.php | 1 - turba/scripts/import_squirrelmail_file_abook.php | 1 - turba/scripts/import_squirrelmail_sql_abook.php | 1 - turba/scripts/import_vcards.php | 1 - turba/scripts/upgrades/2.1_to_2.2_sql_schema.php | 1 - .../upgrades/convert_datatree_shares_to_sql.php | 1 - turba/scripts/upgrades/public_to_horde_share.php | 1 - whups/scripts/bugzilla-import.php | 3 +-- whups/scripts/mail-filter.php | 2 -- whups/scripts/obliterate.php | 3 +-- .../upgrades/convert_datatree_shares_to_sql.php | 3 +-- wicked/scripts/mail-filter.php | 1 - wicked/scripts/upgrades/convert_to_utf8.php | 2 -- wicked/scripts/wicked.php | 1 - 60 files changed, 27 insertions(+), 105 deletions(-) diff --git a/agora/scripts/phorum2agora.php b/agora/scripts/phorum2agora.php index f96eb971e..29b408cba 100755 --- a/agora/scripts/phorum2agora.php +++ b/agora/scripts/phorum2agora.php @@ -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']); diff --git a/agora/scripts/upgrades/2007-09-23_last_message.php b/agora/scripts/upgrades/2007-09-23_last_message.php index b4f002f85..35c1d1829 100644 --- a/agora/scripts/upgrades/2007-09-23_last_message.php +++ b/agora/scripts/upgrades/2007-09-23_last_message.php @@ -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'); diff --git a/ansel/scripts/all_images_exif_to_tags.php b/ansel/scripts/all_images_exif_to_tags.php index 747f76761..2664075e6 100755 --- a/ansel/scripts/all_images_exif_to_tags.php +++ b/ansel/scripts/all_images_exif_to_tags.php @@ -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()); } diff --git a/ansel/scripts/ansel.php b/ansel/scripts/ansel.php index 291f1922c..3e20cb6f2 100755 --- a/ansel/scripts/ansel.php +++ b/ansel/scripts/ansel.php @@ -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(), diff --git a/ansel/scripts/recursive_import.php b/ansel/scripts/recursive_import.php index e0245185d..598db2a8c 100755 --- a/ansel/scripts/recursive_import.php +++ b/ansel/scripts/recursive_import.php @@ -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', diff --git a/ansel/scripts/remote_import.php b/ansel/scripts/remote_import.php index e64acb9d9..d942112f6 100755 --- a/ansel/scripts/remote_import.php +++ b/ansel/scripts/remote_import.php @@ -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', diff --git a/ansel/scripts/upgrades/1.0_to_1.1.php b/ansel/scripts/upgrades/1.0_to_1.1.php index 2c7fdf236..43b86ae90 100644 --- a/ansel/scripts/upgrades/1.0_to_1.1.php +++ b/ansel/scripts/upgrades/1.0_to_1.1.php @@ -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 ''", diff --git a/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php b/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php index 56d276aa5..2f64db118 100755 --- a/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php +++ b/ansel/scripts/upgrades/2008-09-16_add_original_date_values.php @@ -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); diff --git a/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php b/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php index ed96e423f..77caf7283 100755 --- a/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php +++ b/ansel/scripts/upgrades/2009-06-14_fix_geolocation_values.php @@ -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); diff --git a/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php b/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php index 72e753a26..638d999ec 100644 --- a/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php +++ b/ansel/scripts/upgrades/2009-06-22_move_geolocation_values.php @@ -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); diff --git a/beatnik/scripts/export_config.php b/beatnik/scripts/export_config.php index 3baa394a4..5a4a01894 100644 --- a/beatnik/scripts/export_config.php +++ b/beatnik/scripts/export_config.php @@ -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'; diff --git a/folks/scripts/activity.php b/folks/scripts/activity.php index 1a38f62bf..b2599d0c8 100644 --- a/folks/scripts/activity.php +++ b/folks/scripts/activity.php @@ -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) { diff --git a/folks/scripts/mail-filter.php b/folks/scripts/mail-filter.php index fafe82118..838348d6e 100644 --- a/folks/scripts/mail-filter.php +++ b/folks/scripts/mail-filter.php @@ -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'; diff --git a/folks/scripts/mail.php b/folks/scripts/mail.php index e4565b04f..580eea5f1 100644 --- a/folks/scripts/mail.php +++ b/folks/scripts/mail.php @@ -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'; diff --git a/folks/scripts/popularity.php b/folks/scripts/popularity.php index 0e9c4df1b..c3bef3fe8 100644 --- a/folks/scripts/popularity.php +++ b/folks/scripts/popularity.php @@ -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) { diff --git a/framework/Auth/lib/Horde/Auth.php b/framework/Auth/lib/Horde/Auth.php index 9bccffec2..85eadb97d 100644 --- a/framework/Auth/lib/Horde/Auth.php +++ b/framework/Auth/lib/Horde/Auth.php @@ -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.")); } diff --git a/framework/Cli/doc/Horde/Cli/colors.php b/framework/Cli/doc/Horde/Cli/colors.php index c7fc4ed8a..f3248a567 100644 --- a/framework/Cli/doc/Horde/Cli/colors.php +++ b/framework/Cli/doc/Horde/Cli/colors.php @@ -5,7 +5,7 @@ */ require 'Horde/Cli.php'; -$cli = Horde_Cli::singleton(); +$cli = new Horde_Cli(); /* Explicit colors */ $cli->writeln($cli->red('Red')); diff --git a/framework/Cli/lib/Horde/Cli.php b/framework/Cli/lib/Horde/Cli.php index faebeb993..3837e4753 100644 --- a/framework/Cli/lib/Horde/Cli.php +++ b/framework/Cli/lib/Horde/Cli.php @@ -14,13 +14,6 @@ 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; } /** diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 6bd63a691..f261ac8c7 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -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; } diff --git a/framework/Memcache/scripts/Horde/Memcache/stats.php b/framework/Memcache/scripts/Horde/Memcache/stats.php index f1cc5275e..81887d93e 100755 --- a/framework/Memcache/scripts/Horde/Memcache/stats.php +++ b/framework/Memcache/scripts/Horde/Memcache/stats.php @@ -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(); diff --git a/framework/Reflection/lib/Horde/Reflection/Cli.php b/framework/Reflection/lib/Horde/Reflection/Cli.php index 68a00e045..0a39d5d24 100644 --- a/framework/Reflection/lib/Horde/Reflection/Cli.php +++ b/framework/Reflection/lib/Horde/Reflection/Cli.php @@ -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); } diff --git a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php index 08306fc04..a8ff63a8f 100755 --- a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php +++ b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php @@ -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(); diff --git a/framework/admintools/horde-create-sequence.php b/framework/admintools/horde-create-sequence.php index 4d2cb58bc..c77f6a205 100755 --- a/framework/admintools/horde-create-sequence.php +++ b/framework/admintools/horde-create-sequence.php @@ -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; diff --git a/framework/admintools/horde-remove-pref.php b/framework/admintools/horde-remove-pref.php index 73535168d..0ff09c8d3 100755 --- a/framework/admintools/horde-remove-pref.php +++ b/framework/admintools/horde-remove-pref.php @@ -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:")); diff --git a/framework/bin/install_framework b/framework/bin/install_framework index cb2043951..ce1502ed4 100755 --- a/framework/bin/install_framework +++ b/framework/bin/install_framework @@ -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; } } diff --git a/framework/devtools/horde-check-themes.php b/framework/devtools/horde-check-themes.php index 853982c0e..0ee34f019 100755 --- a/framework/devtools/horde-check-themes.php +++ b/framework/devtools/horde-check-themes.php @@ -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'; diff --git a/framework/iCalendar/docs/examples/parser.php b/framework/iCalendar/docs/examples/parser.php index 07efe99fd..ee4ab1f6e 100755 --- a/framework/iCalendar/docs/examples/parser.php +++ b/framework/iCalendar/docs/examples/parser.php @@ -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.'); diff --git a/horde/bin/db_migrate b/horde/bin/db_migrate index 3f9f51443..1a3ff5346 100755 --- a/horde/bin/db_migrate +++ b/horde/bin/db_migrate @@ -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'); diff --git a/horde/scripts/import_squirrelmail_file_prefs.php b/horde/scripts/import_squirrelmail_file_prefs.php index 8b325f4b0..db75dd766 100755 --- a/horde/scripts/import_squirrelmail_file_prefs.php +++ b/horde/scripts/import_squirrelmail_file_prefs.php @@ -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'); diff --git a/horde/scripts/import_squirrelmail_sql_prefs.php b/horde/scripts/import_squirrelmail_sql_prefs.php index b42dffb01..c6c3b4ace 100755 --- a/horde/scripts/import_squirrelmail_sql_prefs.php +++ b/horde/scripts/import_squirrelmail_sql_prefs.php @@ -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'); diff --git a/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php b/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php index 42a3a4336..2a1e6311b 100755 --- a/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php +++ b/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php @@ -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', diff --git a/horde/scripts/upgrades/2008-08-29_fix_mdb2_sequences.php b/horde/scripts/upgrades/2008-08-29_fix_mdb2_sequences.php index 661c462f8..a54238575 100755 --- a/horde/scripts/upgrades/2008-08-29_fix_mdb2_sequences.php +++ b/horde/scripts/upgrades/2008-08-29_fix_mdb2_sequences.php @@ -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']); diff --git a/horde/scripts/upgrades/migrate_user_categories.php b/horde/scripts/upgrades/migrate_user_categories.php index d0d5b6c05..c5bb4a6d7 100755 --- a/horde/scripts/upgrades/migrate_user_categories.php +++ b/horde/scripts/upgrades/migrate_user_categories.php @@ -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')); diff --git a/horde/scripts/upgrades/move_history_out_of_datatree.php b/horde/scripts/upgrades/move_history_out_of_datatree.php index 54a662c1e..9a1ade8ca 100755 --- a/horde/scripts/upgrades/move_history_out_of_datatree.php +++ b/horde/scripts/upgrades/move_history_out_of_datatree.php @@ -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(); diff --git a/hylax/scripts/fax_create_recv.php b/hylax/scripts/fax_create_recv.php index 3fa18da2b..f4fcabad2 100755 --- a/hylax/scripts/fax_create_recv.php +++ b/hylax/scripts/fax_create_recv.php @@ -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) { diff --git a/hylax/scripts/fax_save_data.php b/hylax/scripts/fax_save_data.php index 35f87b0f3..a0d6a5947 100755 --- a/hylax/scripts/fax_save_data.php +++ b/hylax/scripts/fax_save_data.php @@ -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); diff --git a/hylax/scripts/fax_save_recv_data.php b/hylax/scripts/fax_save_recv_data.php index 4615aa139..f8d90c08a 100755 --- a/hylax/scripts/fax_save_recv_data.php +++ b/hylax/scripts/fax_save_recv_data.php @@ -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); diff --git a/imp/scripts/query-imap-cache.php b/imp/scripts/query-imap-cache.php index 7f4f7e0a3..4557d3c70 100755 --- a/imp/scripts/query-imap-cache.php +++ b/imp/scripts/query-imap-cache.php @@ -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); diff --git a/ingo/scripts/upgrades/convert_datatree_shares_to_sql.php b/ingo/scripts/upgrades/convert_datatree_shares_to_sql.php index 398a7b1b3..0a10317a1 100755 --- a/ingo/scripts/upgrades/convert_datatree_shares_to_sql.php +++ b/ingo/scripts/upgrades/convert_datatree_shares_to_sql.php @@ -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']); diff --git a/ingo/scripts/upgrades/convert_prefs_to_sql.php b/ingo/scripts/upgrades/convert_prefs_to_sql.php index 84f7d33be..090eff468 100755 --- a/ingo/scripts/upgrades/convert_prefs_to_sql.php +++ b/ingo/scripts/upgrades/convert_prefs_to_sql.php @@ -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') { diff --git a/koward/script/Koward/koward.php b/koward/script/Koward/koward.php index 61ce3e2d2..8b1e0c02c 100644 --- a/koward/script/Koward/koward.php +++ b/koward/script/Koward/koward.php @@ -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 diff --git a/kronolith/scripts/import_squirrelmail_calendar.php b/kronolith/scripts/import_squirrelmail_calendar.php index adace664a..1bd3f39d6 100755 --- a/kronolith/scripts/import_squirrelmail_calendar.php +++ b/kronolith/scripts/import_squirrelmail_calendar.php @@ -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'); diff --git a/kronolith/scripts/upgrades/convert_datatree_shares_to_sql.php b/kronolith/scripts/upgrades/convert_datatree_shares_to_sql.php index a92d7699f..01df78823 100755 --- a/kronolith/scripts/upgrades/convert_datatree_shares_to_sql.php +++ b/kronolith/scripts/upgrades/convert_datatree_shares_to_sql.php @@ -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); diff --git a/kronolith/scripts/upgrades/convert_to_utc.php b/kronolith/scripts/upgrades/convert_to_utc.php index ddd276e7f..db08b94d6 100755 --- a/kronolith/scripts/upgrades/convert_to_utc.php +++ b/kronolith/scripts/upgrades/convert_to_utc.php @@ -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') { diff --git a/nag/scripts/import_vtodos.php b/nag/scripts/import_vtodos.php index 28b41de3d..0ddcbc1d9 100755 --- a/nag/scripts/import_vtodos.php +++ b/nag/scripts/import_vtodos.php @@ -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(); diff --git a/nag/scripts/upgrades/convert_datatree_shares_to_sql.php b/nag/scripts/upgrades/convert_datatree_shares_to_sql.php index 9460d8d0d..b66e25013 100755 --- a/nag/scripts/upgrades/convert_datatree_shares_to_sql.php +++ b/nag/scripts/upgrades/convert_datatree_shares_to_sql.php @@ -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'; diff --git a/nag/scripts/upgrades/create_missing_add_histories_sql.php b/nag/scripts/upgrades/create_missing_add_histories_sql.php index 9cb7cfa8b..45a13fdad 100755 --- a/nag/scripts/upgrades/create_missing_add_histories_sql.php +++ b/nag/scripts/upgrades/create_missing_add_histories_sql.php @@ -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. diff --git a/turba/scripts/import_squirrelmail_file_abook.php b/turba/scripts/import_squirrelmail_file_abook.php index 54c3eb0ae..0ed0a9b89 100755 --- a/turba/scripts/import_squirrelmail_file_abook.php +++ b/turba/scripts/import_squirrelmail_file_abook.php @@ -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'); diff --git a/turba/scripts/import_squirrelmail_sql_abook.php b/turba/scripts/import_squirrelmail_sql_abook.php index 19be83ec0..77e1ac08a 100755 --- a/turba/scripts/import_squirrelmail_sql_abook.php +++ b/turba/scripts/import_squirrelmail_sql_abook.php @@ -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'); diff --git a/turba/scripts/import_vcards.php b/turba/scripts/import_vcards.php index bb47c354a..c7fc44d23 100755 --- a/turba/scripts/import_vcards.php +++ b/turba/scripts/import_vcards.php @@ -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(); diff --git a/turba/scripts/upgrades/2.1_to_2.2_sql_schema.php b/turba/scripts/upgrades/2.1_to_2.2_sql_schema.php index bcbc64f22..dba6aa234 100755 --- a/turba/scripts/upgrades/2.1_to_2.2_sql_schema.php +++ b/turba/scripts/upgrades/2.1_to_2.2_sql_schema.php @@ -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'; diff --git a/turba/scripts/upgrades/convert_datatree_shares_to_sql.php b/turba/scripts/upgrades/convert_datatree_shares_to_sql.php index a69e27c54..773649678 100755 --- a/turba/scripts/upgrades/convert_datatree_shares_to_sql.php +++ b/turba/scripts/upgrades/convert_datatree_shares_to_sql.php @@ -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'; diff --git a/turba/scripts/upgrades/public_to_horde_share.php b/turba/scripts/upgrades/public_to_horde_share.php index 1e35d2ac6..f1854801c 100755 --- a/turba/scripts/upgrades/public_to_horde_share.php +++ b/turba/scripts/upgrades/public_to_horde_share.php @@ -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.'); diff --git a/whups/scripts/bugzilla-import.php b/whups/scripts/bugzilla-import.php index a5b1fd1e3..1b31377dd 100755 --- a/whups/scripts/bugzilla-import.php +++ b/whups/scripts/bugzilla-import.php @@ -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'; diff --git a/whups/scripts/mail-filter.php b/whups/scripts/mail-filter.php index dc1ed838d..34284bd07 100755 --- a/whups/scripts/mail-filter.php +++ b/whups/scripts/mail-filter.php @@ -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']; diff --git a/whups/scripts/obliterate.php b/whups/scripts/obliterate.php index 4c7c9d1b4..88e5fd0e5 100755 --- a/whups/scripts/obliterate.php +++ b/whups/scripts/obliterate.php @@ -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')); diff --git a/whups/scripts/upgrades/convert_datatree_shares_to_sql.php b/whups/scripts/upgrades/convert_datatree_shares_to_sql.php index b230960c0..143e8481b 100755 --- a/whups/scripts/upgrades/convert_datatree_shares_to_sql.php +++ b/whups/scripts/upgrades/convert_datatree_shares_to_sql.php @@ -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'; diff --git a/wicked/scripts/mail-filter.php b/wicked/scripts/mail-filter.php index a2a3c49a0..0903d7f4a 100755 --- a/wicked/scripts/mail-filter.php +++ b/wicked/scripts/mail-filter.php @@ -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'); diff --git a/wicked/scripts/upgrades/convert_to_utf8.php b/wicked/scripts/upgrades/convert_to_utf8.php index 42ea33bcb..47b5ddd09 100755 --- a/wicked/scripts/upgrades/convert_to_utf8.php +++ b/wicked/scripts/upgrades/convert_to_utf8.php @@ -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"); diff --git a/wicked/scripts/wicked.php b/wicked/scripts/wicked.php index f75c9d13f..d0aa06908 100755 --- a/wicked/scripts/wicked.php +++ b/wicked/scripts/wicked.php @@ -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'; -- 2.11.0