diff --git a/bin/oe-console b/bin/oe-console index a83cca82359..6be7758b1cd 100755 --- a/bin/oe-console +++ b/bin/oe-console @@ -8,8 +8,8 @@ use OxidEsales\EshopCommunity\Internal\Container\BootstrapContainerFactory; use OxidEsales\EshopCommunity\Internal\Container\ContainerBuilderFactory; +use OxidEsales\EshopCommunity\Internal\Framework\FileSystem\BootstrapLocator; use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Dao\ShopConfigurationDaoInterface; -use OxidEsales\Facts\Facts; use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -50,7 +50,7 @@ if (!isset($shopConfigurations[$shopId])) { $_POST['shp'] = $shopId; -$bootstrapFilePath = Path::join((new Facts())->getSourcePath(), 'bootstrap.php'); +$bootstrapFilePath = Path::join((new BootstrapLocator())->getProjectRoot(), 'source', 'bootstrap.php'); require_once $bootstrapFilePath; $container = (new ContainerBuilderFactory())->create()->getContainer(); diff --git a/source/Application/Model/Manufacturer.php b/source/Application/Model/Manufacturer.php index 73b716c811d..fa956eaf77e 100644 --- a/source/Application/Model/Manufacturer.php +++ b/source/Application/Model/Manufacturer.php @@ -13,6 +13,7 @@ use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\UtilsFile; use OxidEsales\Eshop\Core\UtilsPic; +use Symfony\Component\Filesystem\Path; /** * Manufacturer manager @@ -440,7 +441,7 @@ public function deletePicture(string $pictureName, string $pictureType, string $ $utilsPic->safePictureDelete( $pictureName, - $pictureDirectory . $utilsFile->getImageDirByType($pictureType), + Path::join($pictureDirectory, $utilsFile->getImageDirByType($pictureType)), 'oxmanufacturers', $pictureFieldName ); diff --git a/source/Core/UtilsFile.php b/source/Core/UtilsFile.php index 24d6cc3ecd9..5368680cdc7 100644 --- a/source/Core/UtilsFile.php +++ b/source/Core/UtilsFile.php @@ -11,6 +11,7 @@ use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Str; use OxidEsales\EshopCommunity\Core\Di\ContainerFacade; +use OxidEsales\EshopCommunity\Internal\Framework\Configuration\BootstrapConfigurationFactory; use OxidEsales\EshopCommunity\Internal\Framework\FileSystem\Bridge\MasterImageHandlerBridgeInterface; use OxidEsales\Facts\Facts; use Symfony\Component\Filesystem\Path; @@ -670,6 +671,9 @@ private function addErrorMessageToDisplay($message): void */ private function makePathRelativeToShopSource(string $path): string { - return Path::makeRelative($path, (new Facts())->getSourcePath()); + return Path::makeRelative( + $path, + Path::join((new BootstrapConfigurationFactory())->create()->getShopDirectory(), 'source') + ); } } diff --git a/source/Core/UtilsPic.php b/source/Core/UtilsPic.php index e4ed7582519..23cf186bc26 100644 --- a/source/Core/UtilsPic.php +++ b/source/Core/UtilsPic.php @@ -9,6 +9,7 @@ use OxidEsales\Eshop\Core\Exception\ExceptionToDisplay; use OxidEsales\EshopCommunity\Core\Di\ContainerFacade; +use OxidEsales\EshopCommunity\Internal\Framework\Configuration\BootstrapConfigurationFactory; use OxidEsales\EshopCommunity\Internal\Framework\FileSystem\Bridge\MasterImageHandlerBridgeInterface; use OxidEsales\Facts\Facts; use OxidEsales\Eshop\Core\Registry; @@ -84,7 +85,7 @@ protected function deletePicture($filename, $masterImagePath) if (!Registry::getConfig()->getConfigParam('sAltImageUrl')) { $generatedImagePath = str_replace('/master/', '/generated/', $masterImagePath); - $files = glob("{$generatedImagePath}*/{$filename}"); + $files = glob(Path::join($generatedImagePath,'*',$filename)); if (\is_array($files)) { foreach ($files as $file) { $removed = unlink($file); @@ -285,6 +286,9 @@ private function removeMasterFile(string $filepath): bool */ private function makePathRelativeToShopSource(string $path): string { - return Path::makeRelative($path, (new Facts())->getSourcePath()); + return Path::makeRelative( + $path, + Path::join((new BootstrapConfigurationFactory())->create()->getShopDirectory()) + ); } } diff --git a/source/Setup/Utilities.php b/source/Setup/Utilities.php index 321997050a6..4957fd50561 100644 --- a/source/Setup/Utilities.php +++ b/source/Setup/Utilities.php @@ -11,6 +11,7 @@ use OxidEsales\DatabaseViewsGenerator\ViewsGenerator; use OxidEsales\DoctrineMigrationWrapper\Migrations; use OxidEsales\DoctrineMigrationWrapper\MigrationsBuilder; +use OxidEsales\EshopCommunity\Internal\Framework\Configuration\BootstrapConfigurationFactory; use OxidEsales\Facts\Facts; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Filesystem\Path; @@ -482,7 +483,7 @@ public function getRootDirectory(): string public function getSqlDirectory(): string { return Path::join( - (new Facts())->getSourcePath(), + Path::join((new BootstrapConfigurationFactory())->create()->getShopDirectory(), 'source'), self::SETUP_DIRECTORY, self::DATABASE_SQL_DIRECTORY ); diff --git a/tests/Codeception/Acceptance/CheckoutProcessCest.php b/tests/Codeception/Acceptance/CheckoutProcessCest.php index 0d0b4a37a33..c4de714c705 100644 --- a/tests/Codeception/Acceptance/CheckoutProcessCest.php +++ b/tests/Codeception/Acceptance/CheckoutProcessCest.php @@ -17,6 +17,7 @@ use OxidEsales\Codeception\Page\Checkout\UserCheckout; use OxidEsales\Codeception\Step\Basket; use OxidEsales\Codeception\Step\UserRegistrationInCheckout; +use OxidEsales\EshopCommunity\Internal\Framework\Configuration\BootstrapConfigurationFactory; use OxidEsales\EshopCommunity\Tests\Codeception\Support\AcceptanceTester; use OxidEsales\Facts\Facts; @@ -444,7 +445,7 @@ public function checkNoSessionCookiesCheckout(AcceptanceTester $I): void $I->updateConfigInDatabase('blShowBirthdayFields', true, 'bool'); file_put_contents( - (new Facts())->getShopRootPath() . '/cust_config.inc.php', + (new BootstrapConfigurationFactory())->create()->getShopDirectory() . '/cust_config.inc.php', 'blSessionUseCookies = false;' ); diff --git a/tests/Codeception/Config/CodeceptionParametersProvider.php b/tests/Codeception/Config/CodeceptionParametersProvider.php index 07dc6651437..238d266fa54 100644 --- a/tests/Codeception/Config/CodeceptionParametersProvider.php +++ b/tests/Codeception/Config/CodeceptionParametersProvider.php @@ -23,11 +23,12 @@ public function getParameters(): array { $facts = new Facts(); - $databaseUrl = getenv('OXID_DB_URL') ?: (new BootstrapConfigurationFactory())->create()->getDatabaseUrl(); + $systemConfiguration = (new BootstrapConfigurationFactory())->create(); + $databaseUrl = getenv('OXID_DB_URL') ?: $systemConfiguration->getDatabaseUrl(); $this->dbConfig = (new DatabaseConfiguration($databaseUrl)); return [ 'SHOP_URL' => getenv('SHOP_URL') ?: $facts->getShopUrl(), - 'SHOP_SOURCE_PATH' => getenv('SHOP_SOURCE_PATH') ?: $facts->getSourcePath(), + 'SHOP_SOURCE_PATH' => getenv('SHOP_SOURCE_PATH') ?: $systemConfiguration->getShopDirectory(), 'VENDOR_PATH' => $facts->getVendorPath(), 'DB_NAME' => $this->getDbName(), 'DB_USERNAME' => $this->getDbUser(), @@ -77,7 +78,7 @@ private function getShopSuitePath(Facts $facts): string { $testSuitePath = (string)getenv('TEST_SUITE'); if ($testSuitePath === '' || $testSuitePath === '0') { - $testSuitePath = $facts->getShopRootPath() . '/tests'; + $testSuitePath = (new BootstrapConfigurationFactory())->create()->getShopDirectory() . '/tests'; } return $testSuitePath; } diff --git a/tests/ConsoleRunnerTrait.php b/tests/ConsoleRunnerTrait.php index 13e0bd280d0..e620eca90a4 100644 --- a/tests/ConsoleRunnerTrait.php +++ b/tests/ConsoleRunnerTrait.php @@ -9,7 +9,7 @@ namespace OxidEsales\EshopCommunity\Tests; -use OxidEsales\Facts\Facts; +use OxidEsales\EshopCommunity\Internal\Framework\FileSystem\BootstrapLocator; use RuntimeException; use Symfony\Component\Process\Process; @@ -43,7 +43,7 @@ public function runInConsoleAndAssertSuccess(string $command): Process private function getPathToConsoleScript(): string { $scriptPath = 'bin/oe-console'; - $shopRootPath = (new Facts())->getShopRootPath(); + $shopRootPath = (new BootstrapLocator())->getProjectRoot(); if (is_file("$shopRootPath/vendor/$scriptPath")) { return "$shopRootPath/vendor/$scriptPath"; } diff --git a/tests/FilesystemTrait.php b/tests/FilesystemTrait.php index 6a65882655e..2a9e0862094 100644 --- a/tests/FilesystemTrait.php +++ b/tests/FilesystemTrait.php @@ -9,6 +9,7 @@ namespace OxidEsales\EshopCommunity\Tests; +use OxidEsales\EshopCommunity\Internal\Framework\Configuration\BootstrapConfigurationFactory; use OxidEsales\Facts\Facts; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; @@ -34,7 +35,7 @@ public function restoreVarDirectory(): void private function init(): void { - $shopRootPath = (new Facts())->getShopRootPath(); + $shopRootPath = (new BootstrapConfigurationFactory())->create()->getShopDirectory(); $this->filesystem = new Filesystem(); $this->varPath = Path::join($shopRootPath, 'var'); $this->varBackupPath = Path::join( diff --git a/tests/Integration/Internal/ComposerPlugin/ComponentInstallerTest.php b/tests/Integration/Internal/ComposerPlugin/ComponentInstallerTest.php index 59787bae5ef..6fc18831642 100644 --- a/tests/Integration/Internal/ComposerPlugin/ComponentInstallerTest.php +++ b/tests/Integration/Internal/ComposerPlugin/ComponentInstallerTest.php @@ -13,6 +13,7 @@ use Composer\Package\Package; use OxidEsales\ComposerPlugin\Installer\Package\ComponentInstaller; use OxidEsales\EshopCommunity\Internal\Container\BootstrapContainerFactory; +use OxidEsales\EshopCommunity\Internal\Framework\Configuration\BootstrapConfigurationFactory; use OxidEsales\EshopCommunity\Internal\Framework\DIContainer\Service\ProjectYamlImportServiceInterface; use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface; use OxidEsales\EshopCommunity\Tests\ContainerTrait; @@ -54,7 +55,7 @@ private function createInstaller(): ComponentInstaller return new ComponentInstaller( new NullIO(), - (new Facts())->getShopRootPath(), + (new BootstrapConfigurationFactory())->create()->getShopDirectory(), $packageStub ); } diff --git a/tests/Integration/Internal/Transition/Utility/ContextTest.php b/tests/Integration/Internal/Transition/Utility/ContextTest.php index 3f4a95c38ca..19833f0e627 100644 --- a/tests/Integration/Internal/Transition/Utility/ContextTest.php +++ b/tests/Integration/Internal/Transition/Utility/ContextTest.php @@ -12,7 +12,6 @@ use OxidEsales\EshopCommunity\Core\Di\ContainerFacade; use OxidEsales\EshopCommunity\Internal\Container\ContainerBuilderFactory; use OxidEsales\EshopCommunity\Internal\Transition\Utility\ContextInterface; -use OxidEsales\Facts\Config\ConfigFile; use PHPUnit\Framework\TestCase; final class ContextTest extends TestCase