Example #1
0
 /**
  * Redirecciona a un error, ejemplo un 404.
  *
  * @param  integer $errno
  * @return void
  */
 public function error($errno)
 {
     $response = new Response();
     header("HTTP/1.0 {$errno} " . $response->getResponseStatus($errno), true, $errno);
     /*
      * Retorna un Response para mostrar el mensaje de que algo salio mal
      * este solo se muestra cuando esta en produccion.         *
      */
     if (!Settings::inDebug()) {
         Settings::set('ForeverPHPTemplate', true);
         $response->render('error', new Context(array('message' => 'Oops, al parecer algo salió mal.')))->make();
     }
 }
Example #2
0
 /**
  * Carga una vez el motor de cache y la
  * configuración del cache.
  *
  * @return void
  */
 private function load()
 {
     // Verifico si el cache esta activo
     if (Settings::get('cacheEnabled')) {
         $this->cacheEnabled = true;
     }
     // Sigue cargando el motor de cache, solo su esta activo
     if ($this->cacheEnabled) {
         $cacheSettings = Settings::get('cache');
         // Se almacenan los ítems de configuración del cache
         $this->engine = $cacheSettings['engine'];
         $this->location = $cacheSettings['location'];
         $this->timeout = $cacheSettings['timeout'];
         $this->maxEntries = $cacheSettings['maxEntries'];
         // Se crea la instancia del motor según la configuración
         if ($this->engine === 'filecache') {
             $this->cacheEngine = new \ForeverPHP\Cache\FileCache($this->location);
         }
     }
 }