Permalink
Browse files

OXDEV-1580 Fix shop switch issue

Shop was not switched because of UtilsObject static instance. Now before
bootstrapping shop, shop-id is being set as request parameter.
  • Loading branch information...
MantasVaitkunas committed Oct 18, 2018
1 parent 1c4859d commit 4f933a9c96371dff063fced4bfd7c2d3140567fb
Showing with 27 additions and 12 deletions.
  1. +27 −12 bin/oe-console
@@ -5,24 +5,39 @@
* See LICENSE file for license details.
*/
$bootstrapFileExist = false;
$bootstrapFiles = [
__DIR__ . '/../source/bootstrap.php',
__DIR__ . '/../../source/bootstrap.php',
__DIR__ . '/../../../source/bootstrap.php',
__DIR__ . '/../../../../source/bootstrap.php',
use OxidEsales\EshopEnterprise\Internal\Console\CommandEventSubscriber;
use OxidEsales\Facts\Facts;
use Symfony\Component\Console\Input\ArgvInput;
use Webmozart\PathUtil\Path;
$autoloadFileExist = false;
$autoloadFiles = [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../vendor/autoload.php',
__DIR__ . '/../../../vendor/autoload.php',
__DIR__ . '/../../../../vendor/autoload.php',
];
foreach ($bootstrapFiles as $bootstrapFile) {
if (file_exists($bootstrapFile)) {
require_once $bootstrapFile;
$bootstrapFileExist = true;
foreach ($autoloadFiles as $autoloadFile) {
if (file_exists($autoloadFile)) {
require_once $autoloadFile;
$autoloadFileExist = true;
break;
}
}
if (!$bootstrapFileExist) {
exit("bootstrap.php file was not found!");
if (!$autoloadFileExist) {
exit("autoload.php file was not found!");
}
$shopId = (int) (new ArgvInput())->getParameterOption(
'--'.CommandEventSubscriber::SHOP_ID_PARAMETER_OPTION_NAME,
0
);
if ($shopId !== 0) {
$_POST['shp'] = $shopId;
}
$bootstrapFilePath = Path::join((new Facts())->getSourcePath(), 'bootstrap.php');
require_once $bootstrapFilePath;
$factory = \OxidEsales\EshopCommunity\Internal\Application\ContainerFactory::getInstance();
$factory->getContainer()->get(OxidEsales\EshopCommunity\Internal\Console\ExecutorInterface::class)->execute();

0 comments on commit 4f933a9

Please sign in to comment.