Remove object assignments by reference and unneded includes
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Jul 2009 19:31:17 +0000 (13:31 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 17 Jul 2009 19:31:17 +0000 (13:31 -0600)
framework/Auth/lib/Horde/Auth/Sql.php
framework/Cache/lib/Horde/Cache.php
framework/Cache/lib/Horde/Cache/Sql.php
framework/Editor/lib/Horde/Editor.php
framework/History/lib/Horde/History.php
framework/SessionHandler/lib/Horde/SessionHandler.php
framework/SessionHandler/lib/Horde/SessionHandler/Memcache.php
framework/SessionHandler/lib/Horde/SessionHandler/Sql.php
framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php
framework/Token/lib/Horde/Token/Sql.php
framework/Util/lib/Horde/Util.php

index e2674e3..32cc5bb 100644 (file)
@@ -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);
             }
index 4d9b3c3..bcf2804 100644 (file)
@@ -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
index dab86a0..d906ad9 100644 (file)
@@ -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']))
index 1350737..3cd6534 100644 (file)
@@ -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];
index 87c858b..d9ef516 100644 (file)
@@ -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;
         }
index 4a4c6ee..7258b83 100644 (file)
@@ -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().
index 59ba2cb..95450e7 100644 (file)
@@ -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);
         }
index ab62dea..86f2731 100644 (file)
@@ -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);
             }
index c950a87..e97ba26 100755 (executable)
@@ -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';
index 724d0ae..6d94ad4 100644 (file)
@@ -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;
             }
index 2e8e9c8..7d0e93b 100644 (file)
@@ -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);