Skip to content

Commit 625f7b7

Browse files
authored
IBX-8534: Cleaned up deprecations (#456)
For more details see https://issues.ibexa.co/browse/IBX-8534 and #456 Key changes: * Removed deprecation from `SectionService::countAssignedContents` and `SectionService::count` methods, as they're used by AdminUI and there is no replacement for them * Removed deprecation from `\Ibexa\Core\FieldType\Image\Value::fromString` * Dropped \Ibexa\Core\Helper\FieldHelper::getFieldDefinition * Dropped \Ibexa\Core\FieldType\StorageGateway * Dropped \Ibexa\Contracts\Core\Persistence\Content\ContentInfo::STATUS_ARCHIVED * Dropped \Ibexa\Contracts\Core\Persistence\Content\ContentInfo::$isPublished * Dropped $name from bookmarks * Dropped \Ibexa\Contracts\Core\Persistence\Content\Handler::loadRelations * Dropped Identity contracts * Injected TransactionHandler into repository * Dropped imageValue::path * Dropped imageValue::path * Dropped \Ibexa\Core\FieldType\Image\Value::fromString * Dropped \Ibexa\Contracts\Core\Persistence\Content\LoadStruct * Dropped \Ibexa\Core\Persistence\Cache\PersistenceLogger::getCount * Dropped \Ibexa\Contracts\Core\Repository\PasswordHashService * Dropped Location::pathIdentificationString * Dropped markSubtreeModified & updateSubtreeModificationTime * Dropped \Ibexa\Contracts\Core\Persistence\FieldType\IsEmptyValue * Dropped Indexer::createSearchIndex * Dropped \Ibexa\Contracts\Core\Persistence\User\Handler::loadPoliciesByUserId * Dropped \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsMainLocation::createFromQueryBuilder * Dropped \Ibexa\Core\Repository\Helper\RoleDomainMapper * Dropped Ibexa\Core\Repository\Helper\NameSchemaService * Dropped \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\Priority::createFromQueryBuilder * Dropped Location::SORT_FIELD_MODIFIED_SUBNODE * Replaced abstract Criterion with CriterionInterface
1 parent ddc2855 commit 625f7b7

File tree

180 files changed

+578
-2108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+578
-2108
lines changed

phpstan-baseline.neon

Lines changed: 2 additions & 387 deletions
Large diffs are not rendered by default.

src/bundle/Core/ApiLoader/RepositoryFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler as ContentFilteringHandler;
1212
use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler;
1313
use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler;
14+
use Ibexa\Contracts\Core\Persistence\TransactionHandler;
1415
use Ibexa\Contracts\Core\Repository\LanguageResolver;
1516
use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface;
1617
use Ibexa\Contracts\Core\Repository\PasswordHashService;
1718
use Ibexa\Contracts\Core\Repository\PermissionService;
1819
use Ibexa\Contracts\Core\Repository\Repository;
19-
use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy;
2020
use Ibexa\Contracts\Core\Repository\Validator\ContentValidator;
2121
use Ibexa\Contracts\Core\Search\Handler as SearchHandler;
2222
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
@@ -81,7 +81,6 @@ public function buildRepository(
8181
RelationProcessor $relationProcessor,
8282
FieldTypeRegistry $fieldTypeRegistry,
8383
PasswordHashService $passwordHashService,
84-
ThumbnailStrategy $thumbnailStrategy,
8584
ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory,
8685
Mapper\ContentDomainMapper $contentDomainMapper,
8786
Mapper\ContentTypeDomainMapper $contentTypeDomainMapper,
@@ -95,6 +94,7 @@ public function buildRepository(
9594
PasswordValidatorInterface $passwordValidator,
9695
ConfigResolverInterface $configResolver,
9796
NameSchemaServiceInterface $nameSchemaService,
97+
TransactionHandler $transactionHandler
9898
): Repository {
9999
$config = $this->repositoryConfigurationProvider->getRepositoryConfig();
100100

@@ -105,7 +105,6 @@ public function buildRepository(
105105
$relationProcessor,
106106
$fieldTypeRegistry,
107107
$passwordHashService,
108-
$thumbnailStrategy,
109108
$proxyDomainMapperFactory,
110109
$contentDomainMapper,
111110
$contentTypeDomainMapper,
@@ -120,6 +119,7 @@ public function buildRepository(
120119
$passwordValidator,
121120
$configResolver,
122121
$nameSchemaService,
122+
$transactionHandler,
123123
[
124124
'role' => [
125125
'policyMap' => $this->policyMap,

src/bundle/Core/Command/CleanupVersionsCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
177177
$contentInfo,
178178
$removeAll ? null : $this->mapStatusToVersionInfoStatus($status)
179179
);
180+
$versions = iterator_to_array($versions);
180181
$versionsCount = count($versions);
181182

182183
$output->writeln(sprintf(

src/bundle/Core/Command/ReindexCommand.php

Lines changed: 24 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Ibexa\Contracts\Core\Persistence\Content\Location\Handler;
1515
use Ibexa\Contracts\Core\Search\Content\IndexerGateway;
1616
use Ibexa\Core\Base\Exceptions\InvalidArgumentException;
17-
use Ibexa\Core\Search\Common\IncrementalIndexer;
1817
use Ibexa\Core\Search\Common\Indexer;
1918
use Psr\Log\LoggerInterface;
2019
use RuntimeException;
@@ -191,48 +190,31 @@ protected function execute(InputInterface $input, OutputInterface $output): int
191190
throw new InvalidArgumentException('--iteration-count', "The value must be > 0, you provided '{$iterationCount}'");
192191
}
193192

194-
if (!$this->searchIndexer instanceof IncrementalIndexer) {
195-
$output->writeln(<<<EOT
196-
DEPRECATED:
197-
Running indexing against an Indexer that has not been updated to use IncrementalIndexer abstract.
198-
199-
Options that won't be taken into account:
200-
- since
201-
- content-ids
202-
- subtree
203-
- processes
204-
- no-purge
205-
EOT);
206-
$this->searchIndexer->createSearchIndex($output, (int) $iterationCount, !$commit);
207-
} else {
208-
if (\in_array($input->getOption('processes'), ['0', '1'])) {
209-
$io = new SymfonyStyle($input, $output);
210-
$xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled';
211-
$memoryLimit = ini_get('memory_limit');
212-
213-
$io->warning(<<<EOT
214-
It's not recommended to run this command in a single process mode with a large dataset!
215-
216-
For optimal performance, before running this command, make sure that:
217-
- the xdebug extension is disabled (you have it $xdebugState),
218-
- you're running the command in "prod" environment (default: dev),
219-
- memory limit for big databases is set to "-1" or an adequately high value (your value: $memoryLimit),
220-
- --iteration-count is low enough (default: 50),
221-
- number of processes for parallel batch operations is high enough (default: 'auto' is a good choice).
222-
EOT);
223-
224-
if (!$io->confirm('Continue?', true)) {
225-
return self::SUCCESS;
226-
}
227-
}
193+
if (\in_array($input->getOption('processes'), ['0', '1'])) {
194+
$io = new SymfonyStyle($input, $output);
195+
$xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled';
196+
$memoryLimit = ini_get('memory_limit');
197+
198+
$io->warning(<<<EOT
199+
It's not recommended to run this command in a single process mode with a large dataset!
228200
229-
$output->writeln('Re-indexing started for search engine: ' . $this->searchIndexer->getName());
230-
$output->writeln('');
201+
For optimal performance, before running this command, make sure that:
202+
- the xdebug extension is disabled (you have it $xdebugState),
203+
- you're running the command in "prod" environment (default: dev),
204+
- memory limit for big databases is set to "-1" or an adequately high value (your value: $memoryLimit),
205+
- --iteration-count is low enough (default: 50),
206+
- number of processes for parallel batch operations is high enough (default: 'auto' is a good choice).
207+
EOT);
231208

232-
return $this->indexIncrementally($input, $output, $iterationCount, $commit);
209+
if (!$io->confirm('Continue?', true)) {
210+
return self::SUCCESS;
211+
}
233212
}
234213

235-
return self::SUCCESS;
214+
$output->writeln('Re-indexing started for search engine: ' . get_class($this->searchIndexer));
215+
$output->writeln('');
216+
217+
return $this->indexIncrementally($input, $output, $iterationCount, $commit);
236218
}
237219

238220
/**
@@ -253,7 +235,7 @@ protected function indexIncrementally(
253235

254236
$this->searchIndexer->updateSearchIndex($contentIds, $commit);
255237

256-
return 0;
238+
return self::SUCCESS;
257239
}
258240

259241
if ($since = $input->getOption('since')) {
@@ -278,7 +260,7 @@ protected function indexIncrementally(
278260
if (!$count) {
279261
$output->writeln('<error>Could not find any items to index, aborting.</error>');
280262

281-
return 1;
263+
return self::FAILURE;
282264
}
283265

284266
$iterations = ceil($count / $iterationCount);
@@ -326,7 +308,7 @@ protected function indexIncrementally(
326308
// clear leftover progress bar parts
327309
$progress->clear();
328310

329-
return 0;
311+
return self::SUCCESS;
330312
}
331313

332314
/**

src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function reindex()
8282
try {
8383
// In case version has changed we make sure to fetch fresh ContentInfo
8484
$contentInfo = $contentHandler->loadContentInfo($contentInfo->id);
85-
if ($contentInfo->isPublished) {
85+
if ($contentInfo->status === ContentInfo::STATUS_PUBLISHED) {
8686
$this->searchHandler->indexContent(
8787
$contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo)
8888
);
@@ -109,7 +109,7 @@ public function reindex()
109109
try {
110110
// In case version has changed we make sure to fetch fresh ContentInfo
111111
$contentInfo = $contentHandler->loadContentInfo($location->contentId);
112-
if ($contentInfo->isPublished) {
112+
if ($contentInfo->status === ContentInfo::STATUS_PUBLISHED) {
113113
$this->searchHandler->indexContent(
114114
$contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo)
115115
);

src/bundle/Core/Resources/config/helpers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- "@?logger"
1414

1515
Ibexa\Core\Helper\FieldHelper:
16-
arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.content_type', '@ibexa.api.service.field_type']
16+
arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.field_type']
1717

1818
Ibexa\Core\Helper\ContentPreviewHelper:
1919
arguments: ["@event_dispatcher", '@Ibexa\Core\MVC\Symfony\SiteAccess\Router']

src/contracts/Persistence/Bookmark/Bookmark.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ class Bookmark extends ValueObject
1919
*/
2020
public $id;
2121

22-
/**
23-
* Name of the bookmarked location.
24-
*
25-
* @deprecated Property is here purely for BC with 5.x.
26-
*
27-
* @var string
28-
*/
29-
public $name;
30-
3122
/**
3223
* ID of the bookmarked Location.
3324
*

src/contracts/Persistence/Bookmark/CreateStruct.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212

1313
class CreateStruct extends ValueObject
1414
{
15-
/**
16-
* Name of the bookmarked location.
17-
*
18-
* @deprecated Property is here purely for BC with 5.x.
19-
*
20-
* @var string
21-
*/
22-
public $name;
23-
2415
/**
2516
* ID of the bookmarked Location.
2617
*

src/contracts/Persistence/Content/ContentInfo.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class ContentInfo extends ValueObject
2020
public const STATUS_PUBLISHED = 1;
2121
public const STATUS_TRASHED = 2;
2222

23-
/** @deprecated Use {@see ContentInfo::STATUS_TRASHED} */
24-
public const STATUS_ARCHIVED = self::STATUS_TRASHED;
25-
2623
/**
2724
* Content's unique ID.
2825
*
@@ -59,15 +56,6 @@ class ContentInfo extends ValueObject
5956
*/
6057
public $currentVersionNo;
6158

62-
/**
63-
* @deprecated Use {@see ContentInfo::$status} (with value {@see ContentInfo::STATUS_PUBLISHED})
64-
*
65-
* Flag indicating if content is currently published.
66-
*
67-
* @var bool
68-
*/
69-
public $isPublished;
70-
7159
/**
7260
* Content owner's id.
7361
*

src/contracts/Persistence/Content/Handler.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -281,22 +281,6 @@ public function loadRelation(int $relationId): Relation;
281281
*/
282282
public function removeRelation($relationId, $type, ?int $destinationContentId = null);
283283

284-
/**
285-
* Loads relations from $sourceContentId. Optionally, loads only those with $type and $sourceContentVersionNo.
286-
*
287-
* @deprecated 4.5.7 It will be removed in 5.0. Use {@see \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList()} instead.
288-
*
289-
* @param mixed $sourceContentId Source Content ID
290-
* @param mixed|null $sourceContentVersionNo Source Content Version, null if not specified
291-
* @param int|null $type {@see \Ibexa\Contracts\Core\Repository\Values\Content\Relation::COMMON,
292-
* \Ibexa\Contracts\Core\Repository\Values\Content\Relation::EMBED,
293-
* \Ibexa\Contracts\Core\Repository\Values\Content\Relation::LINK,
294-
* \Ibexa\Contracts\Core\Repository\Values\Content\Relation::FIELD}
295-
*
296-
* @return \Ibexa\Contracts\Core\Persistence\Content\Relation[]
297-
*/
298-
public function loadRelations($sourceContentId, $sourceContentVersionNo = null, $type = null);
299-
300284
/**
301285
* Counts all outgoing relations for the given version.
302286
*/

0 commit comments

Comments
 (0)