Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/kernel/Console/Command/ResetCacheCommand.php
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | |||||
* @return null|integer | * @return null|integer | ||||
*/ | */ | ||||
protected function execute(InputInterface $input, OutputInterface $output) | protected function execute(InputInterface $input, OutputInterface $output) | ||||
{ | { | ||||
$success_count = 0; | $success_count = 0; | ||||
$error_count = 0; | $error_count = 0; | ||||
foreach ( $this->optionMap as $option_name => $option_data ) { | foreach ( $this->optionMap as $option_name => $option_data ) { | ||||
if ( !$input->getOption($option_name) ) { | if ( !$this->io->getOption($option_name) ) { | ||||
continue; | continue; | ||||
} | } | ||||
$success_count++; | $success_count++; | ||||
$output->write('- ' . $option_data['description'] . ' ... '); | $this->io->write('- ' . $option_data['description'] . ' ... '); | ||||
$event = new \kEvent($option_data['event']); | $event = new \kEvent($option_data['event']); | ||||
$this->Application->HandleEvent($event); | $this->Application->HandleEvent($event); | ||||
if ( $event->getRedirectParam('action_completed') ) { | if ( $event->getRedirectParam('action_completed') ) { | ||||
$output->writeln('<info>OK</info>'); | $this->io->writeln('<info>OK</info>'); | ||||
} | } | ||||
else { | else { | ||||
$error_count++; | $error_count++; | ||||
$output->writeln('<error>FAILED</error>'); | $this->io->writeln('<error>FAILED</error>'); | ||||
} | } | ||||
} | } | ||||
if ( $success_count === 0 ) { | if ( $success_count === 0 ) { | ||||
throw new \RuntimeException('Please specify at least one reset option'); | throw new \RuntimeException('Please specify at least one reset option'); | ||||
} | } | ||||
return $error_count == 0 ? 0 : 64; | return $error_count == 0 ? 0 : 64; | ||||
} | } | ||||
} | } |