protected function execute(InputInterface $input, OutputInterface $output)
{
$autoRegister = $input->getOption('auto-register');
$installer = new \Installer();
$installed = $installer->tableExists('users_users');
if ($installed) {
$installer->update();
$output->writeln('Update completed.');
if (count($installer->installed)) {
foreach ($installer->installed as $patch) {
$output->writeln("<info>Installed: {$patch}</info>");
}
}
if (count($installer->executed)) {
foreach ($installer->executed as $script) {
$output->writeln("<info>Executed: {$script}</info>");
}
}
$output->writeln('<info>Queries executed successfully: ' . count($installer->success) . '</info>');
if (count($installer->failures)) {
foreach ($installer->failures as $key => $error) {
list($query, $message, $patch) = $error;
$output->writeln("<error>Error {$key} in {$patch}\n\t{$query}\n\t{$message}</error>");
if ($autoRegister) {
$installer->recordPatch($patch);
}
}
}
$cachelib = \TikiLib::lib('cache');
$cachelib->empty_cache();
} else {
$output->writeln('<error>Database not found.</error>');
}
}