From 95eb4c9274fde97d0c83c0c0e3a92105fd7be499 Mon Sep 17 00:00:00 2001 From: Valerij Ivashchenko Date: Mon, 17 Aug 2020 16:51:26 +0300 Subject: [PATCH] Set server request uri to root in CliTaskCommand.php. To prevent redirect when `VQMod` with `SeoPro` used in open cart. --- src/BeyondIT/OCOK/CliTaskCommand.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/BeyondIT/OCOK/CliTaskCommand.php b/src/BeyondIT/OCOK/CliTaskCommand.php index c5ea3c3..22439d6 100644 --- a/src/BeyondIT/OCOK/CliTaskCommand.php +++ b/src/BeyondIT/OCOK/CliTaskCommand.php @@ -8,11 +8,11 @@ use Symfony\Component\Console\Input\InputOption; class CliTaskCommand extends OCOKCommand { - + public function supportedVersions() { return array('2','1.5'); } - + protected function configure() { $this->setName("run") ->setDescription("Run OpenCart controllers as tasks from commandline") @@ -21,14 +21,14 @@ protected function configure() { ->addArgument("route", InputArgument::REQUIRED, "Set the route for the Task Controller") ->addArgument("args", InputArgument::IS_ARRAY, "Custom arguments, which are set as GET or POST (-p option) parameters for the controller script. Added as key/value pairs (e.g. key=value)"); } - + protected function execute(InputInterface $input, OutputInterface $output) { if (parent::execute($input, $output)) { - + if (!$input->getOption("catalog")) { - chdir('admin'); + chdir('admin'); } - + foreach ($input->getArgument("args") as $arg) { $pair = explode("=", $arg); if (count($pair) === 2) { @@ -36,10 +36,12 @@ protected function execute(InputInterface $input, OutputInterface $output) { $_POST[$pair[0]] = $pair[1]; } else { $_GET[$pair[0]] = $pair[1]; - } + } } } + $_SERVER['REQUEST_URI'] = '/'; + ob_start(); require_once $this->getOCDirectory() . DIRECTORY_SEPARATOR . "index.php"; ob_end_clean(); @@ -52,5 +54,5 @@ protected function execute(InputInterface $input, OutputInterface $output) { } - } + } }