本文整理汇总了PHP中KConfig::getDatabaseInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP KConfig::getDatabaseInfo方法的具体用法?PHP KConfig::getDatabaseInfo怎么用?PHP KConfig::getDatabaseInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::getDatabaseInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InputArgument
$console->register('db:schema:dump')->setDescription('Dumps the schema for a component into its schema.sql file')->setDefinition(array(new InputArgument('component', InputArgument::IS_ARRAY, 'Name of the components')))->setCode(function (InputInterface $input, OutputInterface $output) use($console) {
$component = ask_for_component($input, $output, $console);
$migrators = new Migrators($console, $component, false);
$migrators->setOutput($output);
foreach ($migrators as $migrator) {
$migrator->createSchema();
$migrator->write();
$output->writeLn('<info>Dump database schema for com_' . $migrator->getComponent() . '</info>');
}
});
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$console->register('db:dump')->setDescription('Dump data to a sql file')->setDefinition(array(new InputArgument('file', InputArgument::OPTIONAL, 'The output file'), new InputOption('replace-prefix', null, InputOption::VALUE_NONE)))->setCode(function (InputInterface $input, OutputInterface $output) use($console) {
$file = $input->getArgument('file');
$console->loadFramework();
$config = new Config(WWW_ROOT);
$config = new \KConfig($config->getDatabaseInfo());
$cmd = "mysqldump --add-drop-table --extended-insert=FALSE --add-locks --skip-comments -u {$config->user} -p{$config->password} -h{$config->host} -P{$config->port} {$config->name}";
if ($input->getOption('replace-prefix')) {
$cmd .= " | sed -e 's/`{$config->prefix}/`#__/'";
}
if ($file) {
@mkdir(dirname($file), 0755, true);
system("{$cmd} > {$file}");
} else {
passthru($cmd);
}
});
}
$console->register('db:load')->setDescription('Load data from a sql file into the database')->setDefinition(array(new InputArgument('file', InputArgument::REQUIRED, 'The output file')))->setCode(function (InputInterface $input, OutputInterface $output) use($console) {
$file = realpath($input->getArgument('file'));
if (!file_exists($file)) {