Exemplo n.º 1
0
 private static function driver()
 {
     $cacheType = strtolower(Configure::get('cache', 'type'));
     if ($cacheType == 'apc') {
         $cacheDriver = new ApcCache();
         return $cacheDriver;
     }
     if ($cacheType == 'memcache') {
         $redisConfigure = Configure::get('cache', 'memcache');
         $memcache = new Memcache();
         $memcache->connect($redisConfigure['host'], $redisConfigure['port']);
         $cacheDriver = new MemcacheCache();
         $cacheDriver->setMemcache($memcache);
         return $cacheDriver;
     }
     if ($cacheType == 'xcache') {
         $cacheDriver = new XcacheCache();
         return $cacheDriver;
     }
     if ($cacheType == 'redis') {
         $redisConfigure = Configure::get('cache', 'redis');
         $redis = new Redis();
         $redis->connect($redisConfigure['host'], $redisConfigure['port']);
         $cacheDriver = new RedisCache();
         $cacheDriver->setRedis($redis);
         return $cacheDriver;
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $redisHost = Configure::get('redis', 'host');
     $redisPort = Configure::get('redis', 'port');
     $this->connect($redisHost, $redisPort);
 }
Exemplo n.º 3
0
function autoloadLibrary($className)
{
    $className = str_replace('\\', '/', $className);
    $library = Configure::get('library', $className);
    if ($library) {
        require_once APPLICATION_ROOT . '/library/' . $library;
        return;
    }
}
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $databaseType = Configure::get('database', 'type');
     $database = Configure::get('database', $databaseType);
     $database['driver'] = $databaseType;
     $this->addConnection($database);
     $this->setAsGlobal();
     $this->bootEloquent();
 }
Exemplo n.º 5
0
 public static function init()
 {
     $databaseType = Configure::get('database.type');
     if ($databaseType == 'mysql') {
         $databaseConfigure = Configure::get('database.mysql');
         self::setup('mysql:host=' . $databaseConfigure['host'] . ';dbname=' . $databaseConfigure['databasename'], $databaseConfigure['account'], $databaseConfigure['password']);
         //for both mysql or mariaDB
     } else {
         self::setup();
     }
 }
Exemplo n.º 6
0
 protected function configure()
 {
     echo Configure::get('database', 'mysql.host');
 }
Exemplo n.º 7
0
 public static function init()
 {
     $routeType = Configure::get('route', 'type');
     if ($routeType == 'symfony') {
         self::symfony();
     } else {
         if ($routeType == 'map') {
             self::map();
         } else {
             self::pathInfo();
         }
     }
 }
Exemplo n.º 8
0
 public function test()
 {
     echo Configure::get('database.type');
 }