[pLog-svn] r1009 - plog/trunk/class/config
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Feb 8 21:57:17 GMT 2005
Author: oscar
Date: 2005-02-08 21:57:16 +0000 (Tue, 08 Feb 2005)
New Revision: 1009
Modified:
plog/trunk/class/config/configdbstorage.class.php
Log:
I suppose issues 228 and similar ones will be solved by this commit. Removed the need of adding the database info to the database itself, I am sure that it was there for a reason but since I cannot remember it, we'll leave it like that for the time being.
Modified: plog/trunk/class/config/configdbstorage.class.php
===================================================================
--- plog/trunk/class/config/configdbstorage.class.php 2005-02-08 18:13:55 UTC (rev 1008)
+++ plog/trunk/class/config/configdbstorage.class.php 2005-02-08 21:57:16 UTC (rev 1009)
@@ -7,8 +7,8 @@
include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
include_once( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
+ include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
-
/**
* Storage backend that stores/retrieves the data from the plog_config
* table.<br/>
@@ -32,27 +32,14 @@
*/
class ConfigDbStorage extends ConfigAbstractStorage
{
-
- // information needed to connect to the db server
- var $_dbPrefix;
-
// ADOdb handler
var $_db;
// array used to store the options
var $_data;
-
- // DB Host
- var $_dbHost;
-
- // Username to connect to the database
- var $_dbUsername;
-
- // Password to connect to the database
- var $_dbPassword;
-
- // Databaae to use
- var $_dbDatabase;
+
+ // information needed to connect to the db server
+ var $_dbPrefix;
/**
* Connects to the database using the parameters in the config file.
@@ -80,8 +67,6 @@
{
$this->_data = Array();
- //print("data = ");print_r($this->_data);print(" - end of data<br/>");
-
// build and execute the query
$query = "SELECT * FROM ".$this->_dbPrefix."config";
$result = $this->_db->Execute( $query );
@@ -105,26 +90,11 @@
$this->_data[$key] = unserialize( stripslashes($value));
if( $dataType == TYPE_ARRAY && $this->_data[$key] == "" )
$this->_data[$key] = Array();
- //print("deserializing data \"$key\"<br/>");
}
else
$this->_data[$key] = $value;
}
- //
- // :KLUDGE:
- // This shouldn't be done like this, but otherwise we would need to
- // also have this fields anyway in the database table... and they're
- // not there since they come from the configuration file
- //
- $this->_data["db_prefix"] = $this->_dbPrefix;
- $this->_data["db_host"] = $this->_dbHost;
- $this->_data["db_password"] = $this->_dbPassword;
- $this->_data["db_username"] = $this->_dbUsername;
- $this->_data["db_database"] = $this->_dbDatabase;
-
- //print("<br/><br/>data = ");print_r($this->_data);print(" - end of data<br/>");
-
return true;
}
@@ -219,10 +189,8 @@
throw( new Exception( "_updateValue: _getType produced an unexpected value of $type when checking value \"$value\""));
die();
}
-
- //$this->_db->debug=true;
+
$result = $this->_db->Execute( $query );
- //print("<br/>updatequery: ".$query."<br/>");
if( $result )
return true;
@@ -255,9 +223,7 @@
die();
}
- //$this->_db->debug=true;
$result = $this->_db->Execute( $query );
- //print("<br/>query: ".$query."<br/>");
if( $result )
return true;
@@ -298,11 +264,6 @@
*/
function saveValue( $key, $value )
{
- /*if( is_array($value)) {
- print("<br/>saving:<br/>");
- print_r($value);
- }*/
-
if( $this->_keyExists( $key )) {
// just update it in the db
$result = $this->_updateValue( $key, $value );
More information about the pLog-svn
mailing list