[Piwik-svn] r469 - in trunk: libs/Zend/Db/Adapter modules

svnmaster at piwik.org svnmaster at piwik.org
Fri May 9 00:50:57 CEST 2008


Author: matt
Date: 2008-05-09 00:50:56 +0200 (Fri, 09 May 2008)
New Revision: 469

Modified:
   trunk/libs/Zend/Db/Adapter/Abstract.php
   trunk/modules/Piwik.php
Log:
- we now make sure the db information is not displayed in error messages

Modified: trunk/libs/Zend/Db/Adapter/Abstract.php
===================================================================
--- trunk/libs/Zend/Db/Adapter/Abstract.php	2008-05-08 22:16:07 UTC (rev 468)
+++ trunk/libs/Zend/Db/Adapter/Abstract.php	2008-05-08 22:50:56 UTC (rev 469)
@@ -49,7 +49,14 @@
  */
 abstract class Zend_Db_Adapter_Abstract
 {
-
+	/**
+	 * Added by Piwik
+	 */
+	public function resetConfigArray()
+	{
+		$this->_config = array();
+	}
+	
     /**
      * User-provided configuration
      *

Modified: trunk/modules/Piwik.php
===================================================================
--- trunk/modules/Piwik.php	2008-05-08 22:16:07 UTC (rev 468)
+++ trunk/modules/Piwik.php	2008-05-08 22:50:56 UTC (rev 469)
@@ -49,7 +49,6 @@
 		@file_put_contents($path . "/.htaccess", "Deny from all");
 	}
 	
-	// path without trailing slash!!
 	static public function mkdir( $path, $mode = 0755, $denyAccess = true )
 	{
 		if(!is_dir($path))
@@ -90,7 +89,6 @@
 		}
 		
 		$resultCheck = array();
-		
 		foreach($directoriesToCheck as $directoryToCheck)
 		{
 			if( !ereg('^'.preg_quote(PIWIK_INCLUDE_PATH), $directoryToCheck) )
@@ -98,14 +96,12 @@
 				$directoryToCheck = PIWIK_INCLUDE_PATH . $directoryToCheck;
 			}
 			
-			$directory = realpath($directoryToCheck);
-			
-			
 			if(!file_exists($directoryToCheck))
 			{			
 				Piwik::mkdir($directoryToCheck, 0755, false);
 			}
 			
+			$directory = realpath($directoryToCheck);
 			$resultCheck[$directory] = false;
 			if(is_writable($directoryToCheck))
 			{
@@ -800,7 +796,6 @@
 			$dbInfos['password'] = '';
 		}
 		
-//		var_dump($dbInfos);
 		// test with the password ='][{}!3456&&^#gegq"eQ for example
 		if(substr($dbInfos['password'],0,1) == '"'
 			&& substr($dbInfos['password'],-1,1) == '"'
@@ -809,7 +804,6 @@
 			$dbInfos['password'] = substr($dbInfos['password'], 1, -1);
 		}
 		$dbInfos['password'] = htmlspecialchars_decode($dbInfos['password']);
-//		var_dump($dbInfos);exit;// we remove the slashes
 		
 		$db = Zend_Db::factory($config->database->adapter, $dbInfos);
 		$db->getConnection();
@@ -817,8 +811,8 @@
 		$db->getConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
 		$db->getConnection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);		
 		Zend_Db_Table::setDefaultAdapter($db);
+		$db->resetConfigArray(); // we don't want this information to appear in the logs
 		Zend_Registry::set('db', $db);
-		
 	}
 
 	static public function createLogObject()
@@ -966,10 +960,6 @@
 				$db->query( $tableSql );
 			}
 		}
-		
-		$queries = array(
-			
-		);
 	}
 	
 	static public function install()



More information about the Piwik-svn mailing list