本文整理匯總了PHP中Symfony\Component\Console\Output\OutputInterface::success方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputInterface::success方法的具體用法?PHP OutputInterface::success怎麽用?PHP OutputInterface::success使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Output\OutputInterface
的用法示例。
在下文中一共展示了OutputInterface::success方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$uid = $input->getArgument('uid');
$account = User::load($uid);
if (!$account) {
// Error loading User entity.
throw new \InvalidArgumentException(sprintf($this->trans('commands.user.login.clear.attempts.errors.invalid-user'), $uid));
}
// Define event name and identifier.
$event = 'user.failed_login_user';
// Identifier is created by uid and IP address,
// Then we defined a generic identifier.
$identifier = "{$account->id()}-";
// Retrieve current database connection.
$connection = $this->getDatabase();
// Clear login attempts.
$connection->delete('flood')->condition('event', $event)->condition('identifier', $connection->escapeLike($identifier) . '%', 'LIKE')->execute();
// Command executed successful.
$output->success(sprintf($this->trans('commands.user.login.clear.attempts.messages.successful'), $uid));
}
示例2: backupDatabase
/**
* @param \Symfony\Component\Console\Output\OutputInterface $io
* @param $key
* @param $instance
* Backup database
*/
private function backupDatabase(OutputInterface $io, $key, $instance)
{
if (array_key_exists('database', $instance)) {
$io->caution(sprintf('Database Backup %s', $key));
$database = $instance['database'];
$dbManager = new DatabaseManager($database['host'], $database['port'], $database['name'], $database['user'], $database['password']);
$dbManager->setTemporaryDirectory($this->tmpTime);
$dbManager->execute();
$io->success(sprintf('Database Backup %s', $key));
}
}