Skip to content

Commit

Permalink
OXDEV-7248 Deprecate config bootstrap parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafOxid authored and liulka-oxid committed Nov 19, 2024
1 parent 9d3df12 commit 3aa822f
Show file tree
Hide file tree
Showing 23 changed files with 127 additions and 17 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG-7.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@

### Changed
- Set the default value of blSkipDebitOldBankInfo to true

### Deprecated
- Config parameters from [config.inc.php](https://docs.oxid-esales.com/developer/en/latest/development/modules_components_themes/project/configincphp.html) will be moved to env or container parameters
- Global functions `warningHandler(), dumpVar(), debug()`
- `ConnectionProviderInterface` will be superseded by `ConnectionFactory` in next version
- Redundant interfaces `TransactionServiceInterface, FinderFactoryInterface`
- `BasicContextInterface` methods
- The `getSslShopUrl` method will be deprecated and replaced by `getShopUrl`, which will now support SSL exclusively
- The use of SSL parameter in `getAltImageUrl` method of PictureHandler will be deleted in next major version
- Method `isEnabledAdminQueryLog()` of ContextInterface
- `handleDatabaseException` functionality
6 changes: 6 additions & 0 deletions source/Core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ class Config extends \OxidEsales\Eshop\Core\Base
* Shops install directory
*
* @var string
*
* @deprecated will be removed in next major, use environment variables instead
*/
protected $sShopDir = null;

/**
* Shops compile directory
*
* @var string
*
* @deprecated will be removed in next major, use environment variables instead
*/
protected $sCompileDir = null;

Expand Down Expand Up @@ -869,6 +873,8 @@ public function getShopUrl($lang = null, $admin = null)
/**
* Returns config sSSLShopURL or sMallSSLShopURL if secondary shop
*
* @deprecated since v8.0 use getShopUrl instead
*
* @param int $lang language (default is null)
*
* @return string
Expand Down
8 changes: 2 additions & 6 deletions source/Core/Exception/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ public function handleUncaughtException(\Throwable $exception)
}

/**
* Report the exception and in case that iDebug is not set, redirect to maintenance page.
* Special methods are used here as the normal exception handling routines always need a database connection and
* this would create a loop.
*
* @param \OxidEsales\Eshop\Core\Exception\DatabaseException $exception Exception to handle
* @deprecated method will be removed in next major, use handleUncaughtException directly
*/
public function handleDatabaseException(\OxidEsales\Eshop\Core\Exception\DatabaseException $exception)
{
Expand All @@ -81,7 +77,7 @@ public function handleDatabaseException(\OxidEsales\Eshop\Core\Exception\Databas


/**
* Exit the application with error status 1
* @deprecated method will be removed in next major, use PHP function directly
*/
protected function exitApplication()
{
Expand Down
8 changes: 8 additions & 0 deletions source/Core/ShopControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ protected function handleCookieException($exception)
}

/**
* @deprecated will be removed in next major, standard execution handling will be used.
*
* Handle database exceptions
* There is still space for improving this as a similar exception handling for database exceptions may be done in
* \OxidEsales\EshopCommunity\Core\Config::init() and the current method may not be executed
Expand Down Expand Up @@ -735,6 +737,8 @@ protected function logException(\Exception $exception)
}

/**
* @deprecated will be removed in next major, standard execution handling will be used.
*
* Notify the shop owner about database connection problems.
*
* This method forms part of the exception handling process. Any further exceptions must be caught.
Expand All @@ -760,6 +764,8 @@ protected function reportDatabaseConnectionException(DatabaseConnectionException
}

/**
* @deprecated will be removed in next major, standard execution handling will be used.
*
* Return true, if a message was already sent within a given threshold.
*
* This method forms part of the exception handling process. Any further exceptions must be caught.
Expand All @@ -784,6 +790,8 @@ protected function messageWasSentWithinThreshold()
}

/**
* @deprecated will be removed in next major, standard execution handling will be used.
*
* Send an offline warning to the shop owner.
* Currently an email is sent to the email address configured as 'sAdminEmail' in the eShop config file.
*
Expand Down
2 changes: 2 additions & 0 deletions source/Core/ViewConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,8 @@ public function getBasketTimeLeft()
* true if blocks javascript code be enabled in templates
*
* @return bool
*
* @deprecated function will be removed in next major version
*/
public function isTplBlocksDebugMode()
{
Expand Down
21 changes: 21 additions & 0 deletions source/Internal/Framework/Database/ConnectionFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/

declare(strict_types=1);

namespace OxidEsales\EshopCommunity\Internal\Framework\Database;

use Doctrine\DBAL\Driver\Connection;
use OxidEsales\Eshop\Core\DatabaseProvider;

class ConnectionFactory implements ConnectionFactoryInterface
{
public function create(): Connection
{
return DatabaseProvider::getDb()->getPublicConnection();
}
}
15 changes: 15 additions & 0 deletions source/Internal/Framework/Database/ConnectionFactoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/

namespace OxidEsales\EshopCommunity\Internal\Framework\Database;

use Doctrine\DBAL\Driver\Connection;

interface ConnectionFactoryInterface
{
public function create(): Connection;
}
3 changes: 3 additions & 0 deletions source/Internal/Framework/Database/ConnectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Doctrine\DBAL\Connection;
use OxidEsales\Eshop\Core\DatabaseProvider;

/**
* @deprecated will be removed in next major, use ConnectionFactory instead
*/
class ConnectionProvider implements ConnectionProviderInterface
{
public function get(): Connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* See LICENSE file for license details.
*/

declare(strict_types=1);

namespace OxidEsales\EshopCommunity\Internal\Framework\Database;

use Doctrine\DBAL\Connection;

/**
* @deprecated will be removed in next major, use ConnectionFactoryInterface instead
*/
interface ConnectionProviderInterface
{
public function get(): Connection;
Expand Down
3 changes: 3 additions & 0 deletions source/Internal/Framework/Database/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace OxidEsales\EshopCommunity\Internal\Framework\Database;

/**
* @deprecated will be removed in next major, use methods from \Doctrine\DBAL\Driver\Connection directly
*/
class TransactionService implements TransactionServiceInterface
{
public function __construct(private ConnectionProviderInterface $connectionProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
* See LICENSE file for license details.
*/

declare(strict_types=1);

namespace OxidEsales\EshopCommunity\Internal\Framework\Database;

/**
* @deprecated will be removed in next major, use methods from \Doctrine\DBAL\Driver\Connection directly
*/
interface TransactionServiceInterface
{
/**
Expand Down
14 changes: 13 additions & 1 deletion source/Internal/Framework/Database/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ services:
OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProviderInterface:
class: OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProvider
public: true
deprecated:
package: 'oxid-esales/oxideshop-ce'
version: '7.2.0'
message: 'The "%service_id%" service is deprecated.'

OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionFactoryInterface:
class: OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionFactory
public: true

OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface:
class: OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactory
public: true

OxidEsales\EshopCommunity\Internal\Framework\Database\TransactionServiceInterface:
class: OxidEsales\EshopCommunity\Internal\Framework\Database\TransactionService
class: OxidEsales\EshopCommunity\Internal\Framework\Database\TransactionService
deprecated:
package: 'oxid-esales/oxideshop-ce'
version: '7.2.0'
message: 'The "%service_id%" service is deprecated.'
3 changes: 3 additions & 0 deletions source/Internal/Framework/FileSystem/FinderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use Symfony\Component\Finder\Finder;

/**
* @deprecated will be removed in next major, use \Symfony\Component\Finder\Finder::create() instead
*/
class FinderFactory implements FinderFactoryInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* See LICENSE file for license details.
*/

declare(strict_types=1);

namespace OxidEsales\EshopCommunity\Internal\Framework\FileSystem;

use Symfony\Component\Finder\Finder;

/**
* @deprecated will be removed in next major, use \Symfony\Component\Finder\Finder::create() instead
*/
interface FinderFactoryInterface
{
/**
Expand Down
4 changes: 4 additions & 0 deletions source/Internal/Framework/FileSystem/bootstrap-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ services:

OxidEsales\EshopCommunity\Internal\Framework\FileSystem\FinderFactoryInterface:
class: OxidEsales\EshopCommunity\Internal\Framework\FileSystem\FinderFactory
deprecated:
package: 'oxid-esales/oxideshop-ce'
version: '7.2.0'
message: 'The "%service_id%" service is deprecated.'

OxidEsales\EshopCommunity\Internal\Framework\Storage\FileStorageFactoryInterface:
class: OxidEsales\EshopCommunity\Internal\Framework\Storage\YamlFileStorageFactory
Expand Down
3 changes: 3 additions & 0 deletions source/Internal/Setup/ConfigFile/ConfigFileDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface;

/**
* @deprecated since version 8.0 you can use container parameters
*/
class ConfigFileDao implements ConfigFileDaoInterface
{
private const PLACEHOLDERS = [
Expand Down
3 changes: 3 additions & 0 deletions source/Internal/Setup/ConfigFile/ConfigFileDaoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace OxidEsales\EshopCommunity\Internal\Setup\ConfigFile;

/**
* @deprecated since version 8.0 you can use container parameters
*/
interface ConfigFileDaoInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace OxidEsales\EshopCommunity\Internal\Setup\ConfigFile;

/**
* @deprecated since version 8.0 the ConfigFile will be removed
*/
class ConfigFileNotFoundException extends \Exception
{
}
3 changes: 3 additions & 0 deletions source/Internal/Setup/ConfigFile/FileNotEditableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace OxidEsales\EshopCommunity\Internal\Setup\ConfigFile;

/**
* @deprecated since version 8.0 the ConfigFile will be removed
*/
class FileNotEditableException extends \Exception
{
}
7 changes: 5 additions & 2 deletions source/Internal/Transition/Utility/BasicContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ public function getGeneratedServicesFilePath(): string
}

/**
* @return string
* @inheritDoc
*/
public function getConfigurableServicesFilePath(): string
{
return Path::join($this->getShopRootPath(), 'var', 'configuration', 'configurable_services.yaml');
}

/**
* @inheritDoc
*/
public function getShopConfigurableServicesFilePath(int $shopId): string
{
return Path::join(
Expand Down Expand Up @@ -159,7 +162,7 @@ public function getProjectConfigurationDirectory(): string
}

/**
* @return string
* @inheritDoc
*/
public function getConfigurationDirectoryPath(): string
{
Expand Down
7 changes: 5 additions & 2 deletions source/Internal/Transition/Utility/BasicContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ public function getContainerCacheFilePath(int $shopId): string;
public function getGeneratedServicesFilePath(): string;

/**
* @return string
* @deprecated functionality will be superseded, method will be removed in next major
*/
public function getConfigurableServicesFilePath(): string;

/**
* @deprecated functionality will be superseded, method will be removed in next major
*/
public function getShopConfigurableServicesFilePath(int $shopId): string;

/**
Expand Down Expand Up @@ -97,7 +100,7 @@ public function getProjectConfigurationDirectory(): string;
public function getShopConfigurationDirectory(int $shopId): string;

/**
* @return string
* @deprecated method will be removed in next major, use getProjectConfigurationDirectory() instead
*/
public function getConfigurationDirectoryPath(): string;

Expand Down
2 changes: 2 additions & 0 deletions source/Internal/Transition/Utility/ContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public function getLogFilePath(): string;
public function getRequiredContactFormFields(): array;

/**
* @deprecated method will be removed in next major version
*
* @return bool
*/
public function isEnabledAdminQueryLog(): bool;
Expand Down
3 changes: 3 additions & 0 deletions source/oxfunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function isAdmin()
*
* @param int $iErrorNr error number
* @param string $sErrorText error message
* @deprecated function will be removed in next major
*/
function warningHandler($iErrorNr, $sErrorText)
{
Expand All @@ -39,6 +40,7 @@ function warningHandler($iErrorNr, $sErrorText)
*
* @param mixed $mVar variable
* @param bool $blToFile marker to write log info to file (must be true to log)
* @deprecated function will be removed in next major
*/
function dumpVar($mVar, $blToFile = false)
{
Expand All @@ -59,6 +61,7 @@ function dumpVar($mVar, $blToFile = false)
* prints anything given into a file, for debugging
*
* @param mixed $mVar variable to debug
* @deprecated function will be removed in next major
*/
function debug($mVar)
{
Expand Down

0 comments on commit 3aa822f

Please sign in to comment.