protected function execute(InputInterface $input, OutputInterface $output) { global $yf_paths; require_once $yf_paths['db_setup_path']; init_yf(); $params = []; // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2') foreach ((array) $input->getArgument('params') as $p) { list($k, $v) = explode('=', trim($p)); $k = trim($k); $v = trim($v); if (strlen($k) && strlen($v)) { $params[$k] = $v; } } $method = $input->getArgument('method'); $methods = ['compare' => 'compare', 'generate' => 'generate', 'create' => 'create', 'apply' => 'apply', 'list' => '_list', 'dump' => 'dump', 'sync' => 'sync']; if ($method && isset($methods[$method])) { $func = $methods[$method]; $text = db()->migrator()->{$func}($params); if (is_array($text)) { $text = _var_export($text); } $output->writeln($text); } else { $table = $this->getHelperSet()->get('table'); $rows = []; foreach ($methods as $name => $real_name) { $rows[] = [$name]; } $table->setHeaders(['Sub-commands'])->setRows($rows); $table->render($output); } }
protected function execute(InputInterface $input, OutputInterface $output) { init_yf(); $DIR_TO_CHECK = APP_PATH; require YF_PATH . '.dev/scripts/assets/assets_urls_check.php'; $output->writeln($text); }
protected function execute(InputInterface $input, OutputInterface $output) { init_yf(); cache()->flush(); $text = 'Cache flushed successfully'; $output->writeln($text); }
protected function execute(InputInterface $input, OutputInterface $output) { init_yf(); $params = []; // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2') foreach ((array) $input->getArgument('params') as $p) { list($k, $v) = explode('=', trim($p)); $k = trim($k); $v = trim($v); if (strlen($k) && strlen($v)) { $params[$k] = $v; } } $method = $input->getArgument('method'); $methods = get_class_methods(_class('core_api')); $methods = array_combine($methods, $methods); foreach ($methods as $name) { if ($name[0] == '_') { unset($methods[$name]); } } if ($method && in_array($method, $methods)) { $text = _class('core_api')->{$method}($params); $output->writeln($text); } else { $table = $this->getHelperSet()->get('table'); $rows = []; foreach ($methods as $name) { $rows[] = [$name]; } $table->setHeaders(['API method'])->setRows($rows); $table->render($output); } }
protected function execute(InputInterface $input, OutputInterface $output) { init_yf(); if (!defined('PROJECT_PATH') || !strlen(constant('PROJECT_PATH'))) { $output->writeln('Error: not inside a project'); return false; } foreach ((array) main()->get_data('locale_langs') as $lang => $linfo) { echo '== ' . $lang . ' ==' . PHP_EOL; list($tr_vars) = module('locale_editor')->_get_vars_from_files($lang); if (!$tr_vars) { continue; } $fname = './langs_exported_' . $lang . '.csv'; $data = []; $data['__'] = '"key";"val"'; foreach ((array) $tr_vars as $k => $v) { $k = trim($k); $v = trim($v); if (!strlen($k)) { continue; } $data[$k] = '"' . str_replace('"', '\\\\"', str_replace('_', ' ', $k)) . '";"' . str_replace('"', '\\\\"', str_replace('_', ' ', $v)) . '"'; } ksort($data); file_put_contents($fname, implode(PHP_EOL, $data)); passthru('ls -l ' . escapeshellarg($fname)); } }
protected function execute(InputInterface $input, OutputInterface $output) { init_yf(); if (!defined('PROJECT_PATH') || !strlen(constant('PROJECT_PATH'))) { $output->writeln('Error: not inside a project'); return false; } _class('manage_assets', 'admin_modules/')->cache_fill(); }
protected function execute(InputInterface $input, OutputInterface $output) { init_yf(); $params = []; // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2') foreach ((array) $input->getArgument('params') as $p) { list($k, $v) = explode('=', trim($p)); $k = trim($k); $v = trim($v); if (strlen($k) && strlen($v)) { $params[$k] = $v; } } // TODO $output->writeln($text); }
protected function execute(InputInterface $input, OutputInterface $output) { global $yf_paths; require_once $yf_paths['db_setup_path']; init_yf(); $params = []; // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2') foreach ((array) $input->getArgument('params') as $p) { list($k, $v) = explode('=', trim($p)); $k = trim($k); $v = trim($v); if (strlen($k) && strlen($v)) { $params[$k] = $v; } } // TODO }
protected function execute(InputInterface $input, OutputInterface $output) { global $yf_paths; require_once $yf_paths['db_setup_path']; init_yf(); $params = []; // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2') foreach ((array) $input->getArgument('params') as $p) { list($k, $v) = explode('=', trim($p)); $k = trim($k); $v = trim($v); if (strlen($k) && strlen($v)) { $params[$k] = $v; } } $method = $input->getArgument('method'); $methods = []; $methods[] = 'conf'; foreach (get_class_methods(db()->utils()) as $v) { if (substr($v, 0, 1) !== '_') { $methods[] = $v; } } $methods = array_combine($methods, $methods); if ($method == 'conf' || $method == 'get_conf') { $vars = ['DB_TYPE' => DB_TYPE, 'DB_HOST' => DB_HOST, 'DB_NAME' => DB_NAME, 'DB_USER' => DB_USER, 'DB_PSWD' => DB_PSWD, 'DB_PREFIX' => DB_PREFIX, 'DB_CHARSET' => DB_CHARSET]; $output->writeln(_var_export($vars)); } elseif ($method && isset($methods[$method])) { $func = $methods[$method]; $text = db()->utils()->{$func}($params); if (is_array($text)) { $text = _var_export($text); } $output->writeln($text); } else { $table = $this->getHelperSet()->get('table'); $rows = []; foreach ($methods as $name => $real_name) { $rows[] = [$name]; } $table->setHeaders(['Sub-commands'])->setRows($rows); $table->render($output); } }