本文整理汇总了PHP中Installer::recordPatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::recordPatch方法的具体用法?PHP Installer::recordPatch怎么用?PHP Installer::recordPatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::recordPatch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
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>');
}
}
示例2: foreach
$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();