From def290e68df5243289d2217150d7d1bd4c76581c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 17 Jul 2009 13:31:17 -0600 Subject: [PATCH] Remove object assignments by reference and unneded includes --- framework/Auth/lib/Horde/Auth/Sql.php | 12 ++++++------ framework/Cache/lib/Horde/Cache.php | 2 +- framework/Cache/lib/Horde/Cache/Sql.php | 7 +++---- framework/Editor/lib/Horde/Editor.php | 6 +++--- framework/History/lib/Horde/History.php | 10 +++++----- framework/SessionHandler/lib/Horde/SessionHandler.php | 2 +- .../SessionHandler/lib/Horde/SessionHandler/Memcache.php | 4 ++-- framework/SessionHandler/lib/Horde/SessionHandler/Sql.php | 12 ++++++------ .../scripts/Horde/SessionHandler/horde-active-sessions.php | 3 +-- framework/Token/lib/Horde/Token/Sql.php | 13 ++++++------- framework/Util/lib/Horde/Util.php | 2 +- 11 files changed, 35 insertions(+), 38 deletions(-) diff --git a/framework/Auth/lib/Horde/Auth/Sql.php b/framework/Auth/lib/Horde/Auth/Sql.php index e2674e3a3..32cc5bbd5 100644 --- a/framework/Auth/lib/Horde/Auth/Sql.php +++ b/framework/Auth/lib/Horde/Auth/Sql.php @@ -438,9 +438,9 @@ class Horde_Auth_Sql extends Horde_Auth_Base } /* Connect to the SQL server using the supplied parameters. */ - $this->_write_db = &DB::connect($this->_params, - array('persistent' => !empty($this->_params['persistent']), - 'ssl' => !empty($this->_params['ssl']))); + $this->_write_db = DB::connect($this->_params, + array('persistent' => !empty($this->_params['persistent']), + 'ssl' => !empty($this->_params['ssl']))); if ($this->_write_db instanceof PEAR_Error) { throw new Horde_Auth_Exception($this->_write_db); } @@ -458,9 +458,9 @@ class Horde_Auth_Sql extends Horde_Auth_Base * seperately. */ if (!empty($this->_params['splitread'])) { $params = array_merge($this->_params, $this->_params['read']); - $this->_db = &DB::connect($params, - array('persistent' => !empty($params['persistent']), - 'ssl' => !empty($params['ssl']))); + $this->_db = DB::connect($params, + array('persistent' => !empty($params['persistent']), + 'ssl' => !empty($params['ssl']))); if ($this->_db instanceof PEAR_Error) { throw new Horde_Auth_Exception($this->_db); } diff --git a/framework/Cache/lib/Horde/Cache.php b/framework/Cache/lib/Horde/Cache.php index 4d9b3c35a..bcf2804e5 100644 --- a/framework/Cache/lib/Horde/Cache.php +++ b/framework/Cache/lib/Horde/Cache.php @@ -66,7 +66,7 @@ class Horde_Cache * multiple Horde_Cache instances) are required. * * This method must be invoked as: - * $var = &Horde_Cache::singleton() + * $var = Horde_Cache::singleton() * * @param mixed $driver The type of concrete Horde_Cache subclass to * return. If $driver is an array, then we will look diff --git a/framework/Cache/lib/Horde/Cache/Sql.php b/framework/Cache/lib/Horde/Cache/Sql.php index dab86a07f..d906ad92e 100644 --- a/framework/Cache/lib/Horde/Cache/Sql.php +++ b/framework/Cache/lib/Horde/Cache/Sql.php @@ -106,7 +106,7 @@ class Horde_Cache_Sql extends Horde_Cache_Base /* Create the memory cache object, if configured. */ if (!empty($this->_params['use_memorycache'])) { - $this->_mc = &Horde_Cache::singleton($params['use_memorycache'], !empty($conf['cache'][$params['use_memorycache']]) ? $conf['cache'][$params['use_memorycache']] : array()); + $this->_mc = Horde_Cache::singleton($params['use_memorycache'], !empty($conf['cache'][$params['use_memorycache']]) ? $conf['cache'][$params['use_memorycache']] : array()); } parent::__construct($this->_params); @@ -358,8 +358,7 @@ class Horde_Cache_Sql extends Horde_Cache_Base throw new Horde_Exception($result->getMessage()); } - require_once 'DB.php'; - $this->_write_db = &DB::connect( + $this->_write_db = DB::connect( $this->_params, array('persistent' => !empty($this->_params['persistent']), 'ssl' => !empty($this->_params['ssl'])) @@ -379,7 +378,7 @@ class Horde_Cache_Sql extends Horde_Cache_Base * seperately. */ if (!empty($this->_params['splitread'])) { $params = array_merge($this->_params, $this->_params['read']); - $this->_db = &DB::connect( + $this->_db = DB::connect( $params, array('persistent' => !empty($params['persistent']), 'ssl' => !empty($params['ssl'])) diff --git a/framework/Editor/lib/Horde/Editor.php b/framework/Editor/lib/Horde/Editor.php index 135073746..3cd65346c 100644 --- a/framework/Editor/lib/Horde/Editor.php +++ b/framework/Editor/lib/Horde/Editor.php @@ -60,7 +60,7 @@ class Horde_Editor * multiple Horde_Editor instances) are required. * * This method must be invoked as: - * $var = &Horde_Editor::singleton() + * $var = Horde_Editor::singleton() * * @param mixed $driver The type of concrete Horde_Editor subclass to * return. If $driver is an array, then we will look @@ -72,7 +72,7 @@ class Horde_Editor * @return Horde_Editor The concrete Horde_Editor reference, or false on * error. */ - public static function &singleton($driver, $params = null) + public static function singleton($driver, $params = null) { static $instances = array(); @@ -82,7 +82,7 @@ class Horde_Editor $signature = serialize(array($driver, $params)); if (!array_key_exists($signature, $instances)) { - $instances[$signature] = &Horde_Editor::factory($driver, $params); + $instances[$signature] = Horde_Editor::factory($driver, $params); } return $instances[$signature]; diff --git a/framework/History/lib/Horde/History.php b/framework/History/lib/Horde/History.php index 87c858bd7..d9ef516de 100644 --- a/framework/History/lib/Horde/History.php +++ b/framework/History/lib/Horde/History.php @@ -40,7 +40,7 @@ class Horde_History * It will only create a new instance if no History instance * currently exists. * - * This method must be invoked as: $var = &History::singleton() + * This method must be invoked as: $var = History::singleton() * * @return Horde_History The concrete Horde_History reference. * @throws Horde_Exception @@ -67,7 +67,7 @@ class Horde_History throw new Horde_Exception(_("The History system is disabled.")); } - $this->_write_db = &DB::connect($conf['sql']); + $this->_write_db = DB::connect($conf['sql']); /* Set DB portability options. */ $portability = DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_ERRORS; @@ -84,7 +84,7 @@ class Horde_History * seperately. */ if (!empty($conf['sql']['splitread'])) { $params = array_merge($conf['sql'], $conf['sql']['read']); - $this->_db = &DB::connect($params); + $this->_db = DB::connect($params); /* Set DB portability options. */ if (is_a($this->_db, 'DB_common')) { @@ -124,7 +124,7 @@ class Horde_History */ public function log($guid, $attributes = array(), $replaceAction = false) { - $history = &$this->getHistory($guid); + $history = $this->getHistory($guid); if (!isset($attributes['who'])) { $attributes['who'] = Horde_Auth::getAuth(); @@ -280,7 +280,7 @@ class Horde_History * get much faster now with a SELECT MAX(history_ts) * ... query. */ try { - $history = &$this->getHistory($guid); + $history = $this->getHistory($guid); } catch (Horde_Exception $e) { return 0; } diff --git a/framework/SessionHandler/lib/Horde/SessionHandler.php b/framework/SessionHandler/lib/Horde/SessionHandler.php index 4a4c6ee6c..7258b8331 100644 --- a/framework/SessionHandler/lib/Horde/SessionHandler.php +++ b/framework/SessionHandler/lib/Horde/SessionHandler.php @@ -99,7 +99,7 @@ class Horde_SessionHandler * currently exists. * * This method must be invoked as: - * $var = &Horde_SessionHandler::singleton() + * $var = Horde_SessionHandler::singleton() * * @param string $driver See Horde_SessionHandler::factory(). * @param array $params See Horde_SessionHandler::factory(). diff --git a/framework/SessionHandler/lib/Horde/SessionHandler/Memcache.php b/framework/SessionHandler/lib/Horde/SessionHandler/Memcache.php index 59ba2cb63..95450e7f6 100644 --- a/framework/SessionHandler/lib/Horde/SessionHandler/Memcache.php +++ b/framework/SessionHandler/lib/Horde/SessionHandler/Memcache.php @@ -73,7 +73,7 @@ class Horde_SessionHandler_Memcache extends Horde_SessionHandler { if (!empty($params['persistent_driver'])) { try { - $this->_persistent = &self::singleton($params['persistent_driver'], empty($params['persistent_params']) ? null : $params['persistent_params']); + $this->_persistent = self::singleton($params['persistent_driver'], empty($params['persistent_params']) ? null : $params['persistent_params']); } catch (Horde_Exception $e) { throw new Horde_Exception('Horde is unable to correctly start the persistent session handler.'); } @@ -113,7 +113,7 @@ class Horde_SessionHandler_Memcache extends Horde_SessionHandler */ protected function _open($save_path = null, $session_name = null) { - $this->_memcache = &Horde_Memcache::singleton(); + $this->_memcache = Horde_Memcache::singleton(); if (is_a($this->_memcache, 'PEAR_Error')) { throw new Horde_Exception($this->_memcache); } diff --git a/framework/SessionHandler/lib/Horde/SessionHandler/Sql.php b/framework/SessionHandler/lib/Horde/SessionHandler/Sql.php index ab62deaae..86f273172 100644 --- a/framework/SessionHandler/lib/Horde/SessionHandler/Sql.php +++ b/framework/SessionHandler/lib/Horde/SessionHandler/Sql.php @@ -84,9 +84,9 @@ class Horde_SessionHandler_Sql extends Horde_SessionHandler } /* Connect to the SQL server using the supplied parameters. */ - $this->_write_db = &DB::connect($this->_params, - array('persistent' => !empty($this->_params['persistent']), - 'ssl' => !empty($this->_params['ssl']))); + $this->_write_db = DB::connect($this->_params, + array('persistent' => !empty($this->_params['persistent']), + 'ssl' => !empty($this->_params['ssl']))); if (is_a($this->_write_db, 'PEAR_Error')) { throw new Horde_Exception($this->_write_db); } @@ -97,9 +97,9 @@ class Horde_SessionHandler_Sql extends Horde_SessionHandler * seperately. */ if (!empty($this->_params['splitread'])) { $params = array_merge($this->_params, $this->_params['read']); - $this->_db = &DB::connect($params, - array('persistent' => !empty($params['persistent']), - 'ssl' => !empty($params['ssl']))); + $this->_db = DB::connect($params, + array('persistent' => !empty($params['persistent']), + 'ssl' => !empty($params['ssl']))); if (is_a($this->_db, 'PEAR_Error')) { throw new Horde_Exception($this->_db); } diff --git a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php index c950a87c6..e97ba2688 100755 --- a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php +++ b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php @@ -20,7 +20,6 @@ // Do CLI checks and environment setup first. require_once HORDE_BASE . '/lib/core.php'; -require_once 'Horde/CLI.php'; // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { @@ -29,7 +28,7 @@ if (!Horde_Cli::runningFromCLI()) { // Load the CLI environment - make sure there's no time limit, init some // variables, etc. -$cli = &Horde_Cli::singleton(); +$cli = Horde_Cli::singleton(); $cli->init(); require_once HORDE_BASE . '/lib/base.php'; diff --git a/framework/Token/lib/Horde/Token/Sql.php b/framework/Token/lib/Horde/Token/Sql.php index 724d0ae90..6d94ad4f1 100644 --- a/framework/Token/lib/Horde/Token/Sql.php +++ b/framework/Token/lib/Horde/Token/Sql.php @@ -196,10 +196,9 @@ class Horde_Token_Sql extends Horde_Token } /* Connect to the SQL server using the supplied parameters. */ - require_once 'DB.php'; - $this->_write_db = &DB::connect($this->_params, - array('persistent' => !empty($this->_params['persistent']), - 'ssl' => !empty($this->_params['ssl']))); + $this->_write_db = DB::connect($this->_params, + array('persistent' => !empty($this->_params['persistent']), + 'ssl' => !empty($this->_params['ssl']))); if (is_a($this->_write_db, 'PEAR_Error')) { return $this->_write_db; } @@ -217,9 +216,9 @@ class Horde_Token_Sql extends Horde_Token * seperately. */ if (!empty($this->_params['splitread'])) { $params = array_merge($this->_params, $this->_params['read']); - $this->_db = &DB::connect($params, - array('persistent' => !empty($params['persistent']), - 'ssl' => !empty($params['ssl']))); + $this->_db = DB::connect($params, + array('persistent' => !empty($params['persistent']), + 'ssl' => !empty($params['ssl']))); if (is_a($this->_db, 'PEAR_Error')) { return $this->_db; } diff --git a/framework/Util/lib/Horde/Util.php b/framework/Util/lib/Horde/Util.php index 2e8e9c857..7d0e93bb6 100644 --- a/framework/Util/lib/Horde/Util.php +++ b/framework/Util/lib/Horde/Util.php @@ -356,7 +356,7 @@ class Horde_Util { /* We may need to set a dummy parameter 'nocache' since some * browsers do not always honor the 'no-cache' header. */ - $browser = &Horde_Browser::singleton(); + $browser = Horde_Browser::singleton(); if ($browser->hasQuirk('cache_same_url')) { if (is_null(self::$_randnum)) { self::$_randnum = base_convert(microtime(), 10, 36); -- 2.11.0