function init(&$c) { $errors = pfcContainerInterface::init($c); // generate the container parameters from other config parameters $this->loadPaths($c); $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")); // test the filemtime php function because it doesn't work on special filesystem // example : NFS, VZFS $filename = $c->data_private_path . '/filemtime.test'; $timetowait = 2; if (is_writable(dirname($filename))) { file_put_contents($filename, 'some-data1-' . time(), LOCK_EX); clearstatcache(); $time1 = filemtime($filename); sleep($timetowait); file_put_contents($filename, 'some-data2-' . time(), LOCK_EX); clearstatcache(); $time2 = filemtime($filename); unlink($filename); if ($time2 - $time1 != $timetowait) { $errors[] = "filemtime php fuction is not usable on your filesystem. Please do not use the 'file' container (try the 'mysql' container) or swith to another filesystem."; } } return $errors; }
function init(&$c) { $errors = pfcContainerInterface::init($c); // generate the container parameters from other config parameters $this->loadPaths($c); $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; }
function init(&$c) { $errors = pfcContainerInterface::init($c); // connect to the db $db = $this->_connect($c); if ($db === FALSE) { $errors[] = _pfc("DB container: connect error"); return $errors; } // create the db if it doesn't exists // golemwashere: commented out this part for now, DB must be manually created /* $db_exists = false; $db_list = mysql_list_dbs($db); while (!$db_exists && $row = mysql_fetch_object($db_list)) $db_exists = ($c->container_cfg_mysql_database == $row->Database); if (!$db_exists) { $query = 'CREATE DATABASE '.$c->container_cfg_mysql_database; $result = mysql_query($query, $db); if ($result === FALSE) { $errors[] = _pfc("Mysql container: create database error '%s'",mysql_error($db)); return $errors; } mysql_select_db($c->container_cfg_mysql_database, $db); } // create the table if it doesn't exists $query = $this->_sql_create_table; $query = str_replace('%engine%', $c->container_cfg_mysql_engine,$query); $query = str_replace('%table%', $c->container_cfg_mysql_table,$query); $query = str_replace('%fieldtype_server%', $c->container_cfg_mysql_fieldtype_server,$query); $query = str_replace('%fieldtype_group%', $c->container_cfg_mysql_fieldtype_group,$query); $query = str_replace('%fieldtype_subgroup%', $c->container_cfg_mysql_fieldtype_subgroup,$query); $query = str_replace('%fieldtype_leaf%', $c->container_cfg_mysql_fieldtype_leaf,$query); $query = str_replace('%fieldtype_leafvalue%', $c->container_cfg_mysql_fieldtype_leafvalue,$query); $query = str_replace('%fieldtype_timestamp%', $c->container_cfg_mysql_fieldtype_timestamp,$query); $result = mysql_query($query, $db); if ($result === FALSE) { $errors[] = _pfc("Mysql container: create table error '%s'",mysql_error($db)); return $errors; } return $errors; */ }