/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $rows = array(); $patch = new Patch(); $patch->setRequest($this->request); $patches = $patch->checkAll($this->url); foreach ($patches as $name => $result) { switch ($result) { case PATCH::PATCHED: $status = '<bg=green>Patched</bg=green>'; break; case PATCH::UNPATCHED: $status = '<error>Unpatched</error>'; break; default: $status = 'Unknown'; } $rows[] = array($name, $status); } if ($input->getOption('json')) { $return = array(); foreach ($rows as $status) { $name = $status[0]; $status = strip_tags($status[1]); $return[$name] = $status; } $this->output->write(json_encode($return)); } else { $this->writeHeader('Patches'); $table = new Table($this->output); $table->setHeaders(array('Name', 'Status'))->setRows($rows)->render(); } }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $rows = []; $patch = new Patch(); $url = new Url(); $patch->setRequest($this->request); $patches = $patch->checkAll($url->clean($input->getArgument('url'))); foreach ($patches as $name => $result) { switch ($result) { case PATCH::PATCHED: $status = '<bg=green>Patched</bg=green>'; break; case PATCH::UNPATCHED: $status = '<error>Unpatched</error>'; break; default: $status = 'Unknown'; } $rows[] = [$name, $status]; } $this->out('Patches', [['type' => 'table', 'data' => [['Name', 'Status'], $rows]]]); }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $this->writeHeader('Patches'); $rows = array(); $patch = new Patch(); $patch->setRequest($this->request); $patches = $patch->checkAll($this->url); foreach ($patches as $name => $result) { switch ($result) { case PATCH::PATCHED: $status = '<bg=green>Patched</bg=green>'; break; case PATCH::UNPATCHED: $status = '<error>Unpatched</error>'; break; default: $status = 'Unknown'; } $rows[] = array($name, $status); } $table = new Table($this->output); $table->setHeaders(array('Name', 'Status'))->setRows($rows)->render(); }
/** * Check for install patches * * @return void */ public function checkPatch() { $patch = new Patch(); $patches = $patch->checkAll($this->url); $rows = array(); foreach ($patches as $name => $result) { switch ($result) { case PATCH::PATCHED: $status = '<span class="pass">Patched</span class="pass">'; break; case PATCH::UNPATCHED: $status = '<span class="fail">Unpatched</span class="fail">'; break; default: $status = 'Unknown'; } $rows[] = array($name, $status); } $this->respond(array('head' => array('Patch', 'Status'), 'body' => $rows)); }
/** * Check for install patches * * @return void */ public function checkPatch() { $patch = new Patch(); $patch->setRequest($this->request); $patches = $patch->checkAll($this->url); $rows = []; foreach ($patches as $name => $result) { switch ($result) { case PATCH::PATCHED: $status = '<span class="pass">Patched</span class="pass">'; break; case PATCH::UNPATCHED: $status = '<span class="fail">Unpatched</span class="fail">'; break; default: $status = 'Unknown'; } $rows[] = [$name, $status]; } $this->respond(['head' => ['Patch', 'Status'], 'body' => $rows]); }
/** * Check for install patches * * @return void */ public function checkPatch() { $patch = new Patch(); $patches = $patch->checkAll($this->url); $rows = array(); foreach ($patches as $name => $result) { switch ($result) { case PATCH::PATCHED: $status = '<span class="pass">Patched</span class="pass">'; break; case PATCH::UNPATCHED: $status = '<span class="fail">Unpatched</span class="fail">'; break; default: $status = 'Unknown'; } switch ($name) { case 'SUPEE-5344': $name = '<a href="https://shoplift.byte.nl/scan/' . $patch->trimUrl($this->url) . '/admin">' . $name . '</a>'; break; } $rows[] = array($name, $status); } $this->respond(array('head' => array('Patch', 'Status'), 'body' => $rows)); }