Ejemplo n.º 1
0
 public function open($save_path, $session_name)
 {
     $this->config = Pfw_Config::get('session');
     $db_route_name = $this->config['handler']['db_route_name'];
     $db_router = new Pfw_Db_Router_Standard($db_route_name);
     $db_route = $db_router->getWriteRoute();
     $this->db = Pfw_Db::factory($db_route, true);
     $this->sessions = array();
     $this->db_table = isset($this->config['handler']['db_table']) ? $this->config['handler']['db_table'] : self::DEFAULT_DB_TABLE;
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Returns an instance of the local cache driver
  * 
  * @return Pfw_Cache|null instance of a Pfw_Cache object or null if none
  * is configured
  */
 public static function getInstance()
 {
     if (!is_null(self::$instance)) {
         return self::$instance;
     }
     if (null == ($local_cache = Pfw_Config::get('local_cache'))) {
         return null;
     }
     if (is_array($local_cache)) {
         $class = $local_cache['class'];
         unset($local_cache['class']);
         $options = $local_cache;
     } else {
         $class = $local_cache;
         $options = array();
     }
     Pfw_Loader::loadClass($class);
     self::$instance = new $class($options);
     return self::$instance;
 }
Ejemplo n.º 3
0
<?php

global $_picnic_path;
$curr_dir = dirname(__FILE__);
// include the environment file
require dirname($curr_dir) . '/conf/environment.php';
// include the paths file
require "{$curr_dir}/prj_paths.php";
// get our project lib file
$_prj_lib_path = rtrim(rtrim($_PATHS['lib'], '/'), "\\");
// begin by setting our project paths as highest priority
$_inc_path = $_prj_lib_path;
// add project third party paths
$_inc_path .= PATH_SEPARATOR . $_prj_lib_path . DIRECTORY_SEPARATOR . "ThirdParty";
// if picnic path is set explicitly, use it, otherwise we assume its already in the include path
if (isset($_picnic_path)) {
    // add picnic path
    $_inc_path .= PATH_SEPARATOR . $_picnic_path;
    // add picnic third party path
    $_inc_path .= PATH_SEPARATOR . $_picnic_path . DIRECTORY_SEPARATOR . "ThirdParty";
}
// setup project include path for our project
set_include_path($_inc_path . PATH_SEPARATOR . get_include_path());
require 'Pfw/Startup/Base.php';
require "{$curr_dir}/prj_global_require.php";
// initialize the config
Pfw_Config::init();
date_default_timezone_set(Pfw_Config::get('default_timezone'));
Ejemplo n.º 4
0
 public function testReset()
 {
     Pfw_Config::init();
     $conf = Pfw_Config::getConfig();
     $this->assertEquals('My Web Host', Pfw_Config::get('webhost'));
     Pfw_Config::setConfig(array('test' => 'ok'));
     $this->assertEquals('ok', Pfw_Config::get('test'));
     $this->assertEquals(null, Pfw_Config::get('webhost'));
     Pfw_Config::reset();
     Pfw_Config::init();
     $this->assertEquals(null, Pfw_Config::get('test'));
     $this->assertEquals('My Web Host', Pfw_Config::get('webhost'));
 }