Skip to content

Commit

Permalink
IBX-8534: Dropped core deprecations (#435)
Browse files Browse the repository at this point in the history
For more details see https://issues.ibexa.co/browse/IBX-8534 and #435

Key changes:

* Dropped deprecated view providers

* Dropped `pagelayout`

* Dropped MetadataHandler

* Dropped overriding session attribute bag storage key

* Dropped deprecated imagemagick configuration

* Dropped usage of deprecated properties

* Dropped mimetype property

* Redone SimplifiedRequest constructor

* Dropped ContentCacheClearEvent

* Dropped getExternalPath & getInternalPath

* Dropped convertToEz

* Dropped PreviewLocationProvider::loadMainLocation

* Dropped deprecated configuration from Common

* Dropped deprecated ezplatform global

* Dropped deprecated Regex Matchers

* Dropped RepositoryPolicyProvider

* Fixed SimplfiedRequest constructor

* Fixed SimplifiedRequest tests - unified port being int instead of string

* Dropped \Ibexa\Bundle\Core\Imagine\VariationPathGenerator

* Dropped \Ibexa\Bundle\Debug\Collector\PersistenceCacheCollector::getCount

* Dropped Installer:createConfiguration

* Dropped \Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator

* Dropped emitting deprecated pre and after user update password events

* Dropped $context from \Ibexa\Contracts\Core\FieldType\FieldStorage methods

* Dropped \Ibexa\Core\FieldType\GatewayBasedStorage

* Dropped \Ibexa\Core\Repository\PermissionsCriterionHandler

* Dropped \Ibexa\Contracts\Core\IO\BinaryFile::$mimeType

* Dropped ContentService::loadContentDraftList

* Dropped ContentService::loadRelations

* Dropped addGateway from tests, as it no longer exists
  • Loading branch information
ViniTou authored Nov 8, 2024
1 parent 78236ff commit aba61e9
Show file tree
Hide file tree
Showing 124 changed files with 462 additions and 3,948 deletions.
882 changes: 1 addition & 881 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

155 changes: 2 additions & 153 deletions src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@

use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorAwareInterface;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\ConfigSuggestion;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

/**
* Configuration parser handling all basic configuration (aka "common").
*/
class Common extends AbstractParser implements SuggestionCollectorAwareInterface
class Common extends AbstractParser
{
/** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface */
private $suggestionCollector;

/**
* Adds semantic configuration definition.
*
Expand All @@ -31,28 +25,6 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
{
$nodeBuilder
->scalarNode('repository')->info('The repository to use. Choose among ibexa.repositories.')->end()
// @deprecated
// Use ibexa.repositories / repository settings instead.
->arrayNode('database')
->info('DEPRECATED. Use ibexa.repositories / repository settings instead.')
->children()
->enumNode('type')->values(['mysql', 'pgsql', 'sqlite'])->info('The database driver. Can be mysql, pgsql or sqlite.')->end()
->scalarNode('server')->end()
->scalarNode('port')->end()
->scalarNode('user')->cannotBeEmpty()->end()
->scalarNode('password')->end()
->scalarNode('database_name')->cannotBeEmpty()->end()
->scalarNode('charset')->defaultValue('utf8')->end()
->scalarNode('socket')->end()
->arrayNode('options')
->info('Arbitrary options, supported by your DB driver ("driver-opts" in PDO)')
->example(['foo' => 'bar', 'someOptionName' => ['one', 'two', 'three']])
->useAttributeAsKey('key')
->prototype('variable')->end()
->end()
->scalarNode('dsn')->info('Full database DSN. Will replace settings above.')->example('mysql://root:root@localhost:3306/ezdemo')->end()
->end()
->end()
->scalarNode('cache_service_name')
->example('cache.app')
->info('The cache pool service name to use for a siteaccess / siteaccess-group, *must* be present.')
Expand All @@ -64,13 +36,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->end()
->arrayNode('api_keys')
->info('Collection of API keys')
->addDefaultsIfNotSet()
->children()
->scalarNode('google_maps')
->setDeprecated('The child node "%node%" at path "%path%" is no longer used and deprecated.')
->info('Google Maps API Key, required as of Google Maps v3 to make sure maps show up correctly.')
->end()
->end()
->scalarPrototype()->end()
->end()
->scalarNode('storage_dir')
->cannotBeEmpty()
Expand All @@ -80,10 +46,6 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->cannotBeEmpty()
->info('Directory where binary files (from ezbinaryfile field type) are stored. Default value is "original"')
->end()
// @deprecated since 5.3. Will be removed in 6.x.
->scalarNode('session_name')
->info('DEPRECATED. Use session.name instead.')
->end()
->arrayNode('session')
->info('Session options. Will override options defined in Symfony framework.session.*')
->children()
Expand All @@ -98,11 +60,6 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->booleanNode('cookie_httponly')->end()
->end()
->end()
->scalarNode('pagelayout')
->info('The default layout to use')
->example('AppBundle::pagelayout.html.twig')
->setDeprecated('The "pagelayout" option is deprecated. Use "page_layout" instead.')
->end()
->scalarNode('page_layout')
->info('The default layout to use')
->example('AppBundle::page_layout.html.twig')
Expand Down Expand Up @@ -152,9 +109,6 @@ public function preMap(array $config, ContextualizerInterface $contextualizer)

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
{
if (isset($scopeSettings['database'])) {
$this->addDatabaseConfigSuggestion($currentScope, $scopeSettings['database']);
}
if (isset($scopeSettings['repository'])) {
$contextualizer->setContextualParameter('repository', $currentScope, $scopeSettings['repository']);
}
Expand All @@ -176,19 +130,6 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn
$contextualizer->setContextualParameter('api_keys.' . $key, $currentScope, $value);
}

// session_name setting is deprecated in favor of session.name
$container = $contextualizer->getContainer();
$sessionOptions = $container->hasParameter("ibexa.site_access.config.$currentScope.session") ? $container->getParameter("ibexa.site_access.config.$currentScope.session") : [];
if (isset($sessionOptions['name'])) {
$contextualizer->setContextualParameter('session_name', $currentScope, $sessionOptions['name']);
}
// @deprecated session_name is deprecated, but if present, in addition to session.name, consider it instead (BC).
if (isset($scopeSettings['session_name'])) {
$sessionOptions['name'] = $scopeSettings['session_name'];
$contextualizer->setContextualParameter('session_name', $currentScope, $scopeSettings['session_name']);
$contextualizer->setContextualParameter('session', $currentScope, $sessionOptions);
}

if (isset($scopeSettings['http_cache']['purge_servers'])) {
$contextualizer->setContextualParameter('http_cache.purge_servers', $currentScope, $scopeSettings['http_cache']['purge_servers']);
}
Expand All @@ -207,100 +148,8 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn
if (isset($scopeSettings['default_page'])) {
$contextualizer->setContextualParameter('default_page', $currentScope, '/' . ltrim($scopeSettings['default_page'], '/'));
}
if (isset($scopeSettings['pagelayout'])) {
// note: "pagelayout" is deprecated, deprecation message is set via Semantic Config Node Builder
$contextualizer->setContextualParameter('pagelayout', $currentScope, $scopeSettings['pagelayout']);
$contextualizer->setContextualParameter('page_layout', $currentScope, $scopeSettings['pagelayout']);
}
if (isset($scopeSettings['page_layout'])) {
// note: "page_layout" as the new setting always takes precedence
$contextualizer->setContextualParameter('pagelayout', $currentScope, $scopeSettings['page_layout']);
$contextualizer->setContextualParameter('page_layout', $currentScope, $scopeSettings['page_layout']);
}
}

/**
* Injects SuggestionCollector.
*
* @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface $suggestionCollector
*/
public function setSuggestionCollector(SuggestionCollectorInterface $suggestionCollector)
{
$this->suggestionCollector = $suggestionCollector;
}

private function addDatabaseConfigSuggestion($sa, array $databaseConfig)
{
$suggestion = new ConfigSuggestion(
<<<EOT
Database configuration has changed for Ibexa Content repository.
Please define:
- An entry in ibexa.repositories
- A Doctrine connection (You may check configuration reference for Doctrine "config:dump-reference doctrine" console command.)
- A reference to configured repository in ibexa.system.$sa.repository
EOT
);
$suggestion->setMandatory(true);
$suggestionArray = [
'driver' => 'pdo_mysql',
'host' => 'localhost',
'dbname' => 'my_database',
'user' => 'my_user',
'password' => 'some_password',
'charset' => 'UTF8',
];

if (!empty($databaseConfig)) {
$suggestionArray['dbname'] = $databaseConfig['database_name'];
$suggestionArray['host'] = $databaseConfig['server'];
$driverMap = [
'mysql' => 'pdo_mysql',
'pgsql' => 'pdo_pgsql',
'sqlite' => 'pdo_sqlite',
];
if (isset($driverMap[$databaseConfig['type']])) {
$suggestionArray['driver'] = $driverMap[$databaseConfig['type']];
} else {
$suggestionArray['driver'] = $databaseConfig['type'];
}
if (isset($databaseConfig['socket'])) {
$suggestionArray['unix_socket'] = $databaseConfig['socket'];
}
$suggestionArray['options'] = $databaseConfig['options'];
$suggestionArray['user'] = $databaseConfig['user'];
$suggestionArray['password'] = $databaseConfig['password'];
}
$suggestion->setSuggestion(
[
'doctrine' => [
'dbal' => [
'connections' => [
'default' => $suggestionArray,
],
],
],
'ibexa' => [
'repositories' => [
'my_repository' => [
'storage' => [
'engine' => 'legacy',
'connection' => 'default',
],
'search' => [
'engine' => 'legacy',
'connection' => 'default',
],
],
],
'system' => [
$sa => [
'repository' => 'my_repository',
],
],
],
]
);

$this->suggestionCollector->addSuggestion($suggestion);
}
}
28 changes: 2 additions & 26 deletions src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,13 @@

use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorAwareInterface;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\ConfigSuggestion;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

/**
* Configuration parser handling all basic configuration (aka "Image").
*/
class Image extends AbstractParser implements SuggestionCollectorAwareInterface
class Image extends AbstractParser
{
/** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface */
private $suggestionCollector;

public function setSuggestionCollector(SuggestionCollectorInterface $suggestionCollector)
{
$this->suggestionCollector = $suggestionCollector;
}

/**
* Adds semantic configuration definition.
*
Expand All @@ -35,13 +24,6 @@ public function setSuggestionCollector(SuggestionCollectorInterface $suggestionC
public function addSemanticConfig(NodeBuilder $nodeBuilder)
{
$nodeBuilder
->arrayNode('imagemagick')
->info('DEPRECATED.')
->children()
->scalarNode('pre_parameters')->info('Parameters that must be run BEFORE the filenames and filters')->end()
->scalarNode('post_parameters')->info('Parameters that must be run AFTER the filenames and filters')->end()
->end()
->end()
->arrayNode('image_variations')
->info('Configuration for your image variations (aka "image aliases")')
->example(
Expand Down Expand Up @@ -119,7 +101,7 @@ static function ($v) {
->end()
->scalarNode('image_host')
->info('Images host. All system images URLs are prefixed with given host if configured.')
->example('https://ezplatform.com')
->example('https://ibexa.co')
->end();
}

Expand All @@ -132,11 +114,5 @@ public function preMap(array $config, ContextualizerInterface $contextualizer)

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
{
if (isset($scopeSettings['imagemagick'])) {
$suggestion = new ConfigSuggestion(
'"imagemagick" settings are deprecated. Just remove them from your configuration file.'
);
$this->suggestionCollector->addSuggestion($suggestion);
}
}
}
16 changes: 0 additions & 16 deletions src/bundle/Core/DependencyInjection/IbexaCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public function load(array $configs, ContainerBuilder $container)

$this->registerRepositoriesConfiguration($config, $container);
$this->registerSiteAccessConfiguration($config, $container);
$this->registerImageMagickConfiguration($config, $container);
$this->registerUrlAliasConfiguration($config, $container);
$this->registerUrlWildcardsConfiguration($config, $container);
$this->registerOrmConfiguration($config, $container);
Expand Down Expand Up @@ -299,21 +298,6 @@ private function registerSiteAccessConfiguration(array $config, ContainerBuilder
ConfigurationProcessor::setGroupsBySiteAccess($groupsBySiteaccess);
}

private function registerImageMagickConfiguration(array $config, ContainerBuilder $container)
{
if (isset($config['imagemagick'])) {
$container->setParameter('ibexa.image.imagemagick.enabled', $config['imagemagick']['enabled']);
if ($config['imagemagick']['enabled']) {
$container->setParameter('ibexa.image.imagemagick.executable_path', dirname($config['imagemagick']['path']));
$container->setParameter('ibexa.image.imagemagick.executable', basename($config['imagemagick']['path']));
}
}

$filters = isset($config['imagemagick']['filters']) ? $config['imagemagick']['filters'] : [];
$filters = $filters + $container->getParameter('ibexa.image.imagemagick.filters');
$container->setParameter('ibexa.image.imagemagick.filters', $filters);
}

private function registerOrmConfiguration(array $config, ContainerBuilder $container): void
{
if (!isset($config['orm']['entity_mappings'])) {
Expand Down

This file was deleted.

17 changes: 0 additions & 17 deletions src/bundle/Core/Imagine/VariationPathGenerator.php

This file was deleted.

Loading

0 comments on commit aba61e9

Please sign in to comment.