protected function up()
 {
     $content_com = fx::component('floxim.main.content');
     fx::db()->query(array('insert into {{field}} (
                 `component_id` ,
                 `keyword` ,
                 `name_en` ,
                 `name_ru` ,
                 `type`)
               VALUES (%d, "type", "Type", "Тип", 1)', $content_com['id']));
     fx::cache('meta')->flush();
 }
Exemplo n.º 2
0
 /**
  * Transform dot-separated component name to full namespace
  * @param type $name
  * @return type
  */
 public static function getComponentNamespace($name)
 {
     return fx::cache('array')->remember('component_namespace_' . strtolower($name), function () use($name) {
         $name = fx::getComponentFullName($name);
         $path = explode(".", $name);
         if ($path[0] === 'floxim' && $path[1] === 'component') {
             array_unshift($path, "floxim");
         }
         foreach ($path as &$part) {
             $chunks = explode("_", $part);
             foreach ($chunks as &$chunk) {
                 $chunk = ucfirst($chunk);
             }
             $part = join('', $chunks);
         }
         $res = '\\' . join('\\', $path);
         return $res;
     });
 }
Exemplo n.º 3
0
 public static function dropStoredStaticCache()
 {
     if (static::isStaticCacheUsed()) {
         fx::cache('meta')->delete(static::getStaticCacheKey());
     }
 }
Exemplo n.º 4
0
Arquivo: Db.php Projeto: floxim/floxim
 public function getSchema()
 {
     $db = $this;
     return fx::cache('meta')->remember('schema', function () use($db) {
         $tables = $db->getCol('show tables');
         $res = array();
         foreach ($tables as $t) {
             $table_name = preg_replace("~^" . $db->prefix . "~", '', $t);
             $res[$table_name] = $db->getIndexedResults('show columns from `' . $t . '`', 'Field');
         }
         return $res;
     }, 60 * 60);
 }