Пример #1
0
 /**
  * Retorna un arreglo qué contiene las cadenas json
  * de los errores registrados
  *
  * @return array
  */
 public static function getArrayLog()
 {
     $log_file = Globals::get('base_path') . '/olimpus/log/errors.log';
     $logs = File::read($log_file);
     if (!$logs) {
         return array();
     }
     return explode("\n", $logs);
 }
Пример #2
0
 /**
  *   Lee el contenido de un archivo en cache, si este existe
  *   y no ha sobrepasado el tiempo de vida
  *
  *   @param array $data Parametros a tomer en cuanta para cachear
  *   @return mixed contenido del archivo si extiste y no a expirado
  *              false de lo contrario
  */
 public static function read($data)
 {
     if (!self::cacheEnabled()) {
         return false;
     }
     $file = self::generateName($data);
     if (false !== ($content = File::read($file))) {
         if (fileatime($file) + self::cacheTime() >= time()) {
             return $content;
         }
         unlink($file);
     }
     return false;
 }