protected function execute(InputInterface $input, OutputInterface $output)
{
$this->ensureExtensionLoaded('apc');
$file = $input->getOption('file');
$noVerification = $input->getOption('no-verification');
if (!$file) {
$file = 'php://stdin';
} else {
if (!is_file($file) || !is_readable($file)) {
throw new \InvalidArgumentException(sprintf("Could not read from file: %s", $file));
}
}
$dump = file_get_contents($file);
$flags = 0;
if (!$noVerification) {
$flags = APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32;
}
$success = $this->getCacheTool()->apc_bin_load($dump, $flags);
if ($output->isVerbose()) {
if ($success) {
$output->writeln("<comment>Load was successful</comment>");
} else {
$output->writeln("<comment>Load was unsuccessful</comment>");
}
}
return $success ? 0 : 1;
}