static function open($save_path, $session_name) { $session_db_connection = Pie_Config::get('pie', 'session', 'dbConnection', null); if (!empty($session_db_connection)) { // use the DB for session $session_db_table = Pie_Config::get('pie', 'session', 'dbTable', null); if (empty($session_db_table)) { throw new Pie_Exception_WrongType(array('field' => 'session_db_table', 'type' => 'string')); } $session_db_data_field = Pie_Config::get('pie', 'session', 'dbDataField', null); if (empty($session_db_table)) { throw new Pie_Exception_WrongType(array('field' => 'session_db_data_field', 'type' => 'string')); } $session_db_id_field = Pie_Config::get('pie', 'session', 'dbIdField', null); if (empty($session_db_id_field)) { throw new Pie_Exception_WrongType(array('field' => 'session_db_id_field', 'type' => 'string')); } $session_db_updated_field = Pie_Config::get('pie', 'session', 'dbUpdatedField', null); if (empty($session_db_updated_field)) { throw new Pie_Exception_WrongType(array('field' => 'session_db_updated_field', 'type' => 'string')); } $session_db_row_class = Pie_Config::get('pie', 'session', 'dbRowClass', null); if (empty($session_db_row_class) or !class_exists($session_db_row_class)) { throw new Pie_Exception_WrongType(array('field' => 'session_db_row_class', 'type' => 'a class name')); } $class = $session_db_row_class; $ancestors = array($class); while ($class = get_parent_class($class)) { $ancestors[] = $class; } if (!in_array('Db_Row', $ancestors)) { throw new Pie_Exception_WrongType(array('field' => 'session_db_row_class', 'type' => 'name of a class that extends Db_Row')); } self::$session_db_connection = $session_db_connection; self::$session_db_table = $session_db_table; self::$session_db_data_field = $session_db_data_field; self::$session_db_id_field = $session_db_id_field; self::$session_db_updated_field = $session_db_updated_field; self::$session_db_row_class = $session_db_row_class; self::$session_db = Db::connect(self::$session_db_connection); } self::$session_save_path = $save_path; return true; }