[Phpfreechat-svn] SF.net SVN: phpfreechat: [944] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-02-07 16:43:09
|
Revision: 944 http://svn.sourceforge.net/phpfreechat/?rev=944&view=rev Author: kerphi Date: 2007-02-07 08:43:01 -0800 (Wed, 07 Feb 2007) Log Message: ----------- fix the mysql container Modified Paths: -------------- trunk/src/containers/file.class.php trunk/src/containers/mysql.class.php trunk/src/pfccontainer.class.php Modified: trunk/src/containers/file.class.php =================================================================== --- trunk/src/containers/file.class.php 2007-02-06 21:59:17 UTC (rev 943) +++ trunk/src/containers/file.class.php 2007-02-07 16:43:01 UTC (rev 944) @@ -33,20 +33,24 @@ "timestamp" => array()); var $_meta = array(); + function pfcContainer_File(&$config) + { + pfcContainerInterface::pfcContainerInterface($config); + } + function loadPaths() { $c =& $this->c; - if (!isset($c->container_cfg_chat_dir)) + if (!isset($c->container_cfg_chat_dir) || $c->container_cfg_chat_dir == '') $c->container_cfg_chat_dir = $c->data_private_path."/chat"; - if (!isset($c->container_cfg_server_dir)) + if (!isset($c->container_cfg_server_dir) || $c->container_cfg_server_dir == '') $c->container_cfg_server_dir = $c->container_cfg_chat_dir."/s_".$c->serverid; } function getDefaultConfig() { $c =& $this->c; - - $cfg = pfcContainer::getDefaultConfig(); + $cfg = pfcContainerInterface::getDefaultConfig(); $cfg["chat_dir"] = ''; // will be generated from the other parameters into the init step $cfg["server_dir"] = ''; // will be generated from the other parameters into the init step return $cfg; @@ -54,15 +58,16 @@ function init() { - $errors = pfcContainer::init(); + $errors = pfcContainerInterface::init(); $c =& $this->c; + // generate the container parameters from other config parameters $this->loadPaths(); $errors = array_merge($errors, @test_writable_dir($c->container_cfg_chat_dir, "container_cfg_chat_dir")); $errors = array_merge($errors, @test_writable_dir($c->container_cfg_server_dir, "container_cfg_chat_dir/serverid")); - + return $errors; } Modified: trunk/src/containers/mysql.class.php =================================================================== --- trunk/src/containers/mysql.class.php 2007-02-06 21:59:17 UTC (rev 943) +++ trunk/src/containers/mysql.class.php 2007-02-07 16:43:01 UTC (rev 944) @@ -42,7 +42,7 @@ * @author Stephane Gully <ste...@gm...> * @author HenkBB */ -class pfcContainer_Mysql extends pfcContainer +class pfcContainer_Mysql extends pfcContainerInterface { var $_db = null; var $_sql_create_table = " @@ -58,13 +58,13 @@ function pfcContainer_Mysql(&$config) { - pfcContainer::pfcContainer($config); + pfcContainerInterface::pfcContainerInterface($config); } function getDefaultConfig() { $c =& $this->c; - $cfg = pfcContainer::getDefaultConfig(); + $cfg = pfcContainerInterface::getDefaultConfig(); $cfg["mysql_host"] = 'localhost'; $cfg["mysql_port"] = 3306; $cfg["mysql_database"] = 'phpfreechat'; @@ -76,7 +76,7 @@ function init() { - $errors = pfcContainer::init(); + $errors = pfcContainerInterface::init(); $c =& $this->c; // connect to the db Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-02-06 21:59:17 UTC (rev 943) +++ trunk/src/pfccontainer.class.php 2007-02-07 16:43:01 UTC (rev 944) @@ -45,7 +45,19 @@ $container_classname = "pfcContainer_".$type; $this->_container =& new $container_classname($this->c); } - + function getDefaultConfig() + { + if ($this->_container) + return $this->_container->getDefaultConfig(); + else + return array(); + } + function init() + { + if ($this->_container) + return $this->_container->init(); + } + /** * Create (connect/join) the nickname into the server or the channel locations * Notice: the caller must take care to update all channels the users joined (use stored channel list into metadata) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |