예제 #1
0
 /**
  * Init Routes.
  *
  * @param array $mode Silla.IO mode.
  *
  * @uses Core\Cache()
  *
  * @access private
  */
 public function __construct(array $mode)
 {
     if (Core\Config()->CACHE['routes']) {
         $routes = Core\Cache()->fetch($mode['location'] . '_routes');
         if (!$routes) {
             $routes = self::loadRoutes($mode);
             Core\Cache()->store($mode['location'] . '_routes', $routes);
         }
     } else {
         $routes = self::loadRoutes($mode);
     }
     foreach ($routes as $route) {
         $this->add(array('pattern' => $route['route'], 'maps_to' => $route['maps']));
     }
     $this->mode = $mode;
 }
예제 #2
0
 /**
  * Get table meta information from cache or extract it, if missing.
  *
  * @param string $tableName Name of the table.
  *
  * @uses   Core\Cache()
  * @uses   extractSchemaMeta()
  *
  * @return array
  */
 private function getSchemaMeta($tableName)
 {
     if (Core\Config()->CACHE['db_schema']) {
         $schemaMeta = Core\Cache()->fetch($tableName);
         if (is_null($schemaMeta)) {
             $schemaMeta = $this->extractSchemaMeta($tableName);
             Core\Cache()->store($tableName, $schemaMeta);
         }
     } else {
         $schemaMeta = $this->extractSchemaMeta($tableName);
     }
     return $schemaMeta;
 }
예제 #3
0
 /**
  * Load Labels file.
  *
  * @param string $fileName Labels file name.
  *
  * @access private
  *
  * @return array
  */
 private static function loadLabelsFile($fileName)
 {
     if (Core\Config()->CACHE['labels']) {
         $key = '_silla_' . Core\Config()->paths('mode') . '_labels_' . Core\Registry()->get('locale') . $fileName;
         $labels = Core\Cache()->fetch($key);
         if (!$labels) {
             $labels = Core\Helpers\YAML::getAll($fileName);
             Core\Cache()->store($key, $labels);
         }
     } else {
         $labels = Core\Helpers\YAML::getAll($fileName);
     }
     return $labels;
 }