Example #1
0
 public function actionExport($args)
 {
     $opt = \Gini\Util::getOpt($args, 'h', ['help', 'json', 'yaml']);
     if (isset($opt['h']) || isset($opt['help'])) {
         echo "Usage: gini config export [-h|--help] [--json|--yaml]\n";
         return;
     }
     \Gini\Config::setup();
     $items = \Gini\Config::export();
     if (isset($opt['json'])) {
         echo J($items, JSON_PRETTY_PRINT) . "\n";
     } else {
         echo yaml_emit($items, YAML_UTF8_ENCODING);
     }
 }
Example #2
0
 private static function _cacheConfig($env)
 {
     $plurals = self::_getORMPlurals();
     printf("%s\n", 'Updating config cache...');
     $config_items = \Gini\Config::fetch();
     // update orm plurals
     $c = (array) $config_items['orm']['plurals'];
     $c += array_filter($plurals, function ($v) use($c) {
         return in_array($v, $c);
     });
     $config_items['orm']['plurals'] = $c;
     $config_file = APP_PATH . '/cache/config.json';
     \Gini\File::ensureDir(APP_PATH . '/cache');
     file_put_contents($config_file, J($config_items));
     \Gini\Config::setup();
     echo "   done.\n";
 }