當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Installer::recordPatch方法代碼示例

本文整理匯總了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>');
     }
 }
開發者ID:rjsmelo,項目名稱:tiki,代碼行數:34,代碼來源:UpdateCommand.php

示例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();
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:31,代碼來源:shell.php


注:本文中的Installer::recordPatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。