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>'); } }
$installer->update(); if (count($installer->installed)) { echo "\tPatches installed:\n"; foreach ($installer->installed as $patch) { echo "\t\t{$patch}\n"; } } if (count($installer->executed)) { echo "\tScripts executed:\n"; foreach ($installer->executed as $script) { echo "\t\t{$script}\n"; } } echo "\tQueries executed successfully: " . count($installer->success) . "\n"; if (count($installer->failures)) { echo "\tErrors:\n"; foreach ($installer->failures as $key => $error) { list($query, $message, $patch) = $error; if (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'skiperrors') { echo "\tSkipping {$patch}\n"; $installer->recordPatch($patch); } else { echo "\t===== Error {$key} in {$patch} =====\n\t{$query}\n\t{$message}\n"; } } } } # Clear caches, since patches often manipulate the database directly without using the functions normally available outside the installer. # All caches, even though scripts and patches surely don't affect them all. require_once 'lib/cache/cachelib.php'; $cachelib->empty_cache();