Skip to content

Commit

Permalink
IBX-8534: Cleaned up deprecations (#456)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ViniTou authored Dec 10, 2024
1 parent ddc2855 commit 625f7b7
Show file tree
Hide file tree
Showing 180 changed files with 578 additions and 2,108 deletions.
389 changes: 2 additions & 387 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/bundle/Core/ApiLoader/RepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler as ContentFilteringHandler;
use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler;
use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler;
use Ibexa\Contracts\Core\Persistence\TransactionHandler;
use Ibexa\Contracts\Core\Repository\LanguageResolver;
use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface;
use Ibexa\Contracts\Core\Repository\PasswordHashService;
use Ibexa\Contracts\Core\Repository\PermissionService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy;
use Ibexa\Contracts\Core\Repository\Validator\ContentValidator;
use Ibexa\Contracts\Core\Search\Handler as SearchHandler;
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
Expand Down Expand Up @@ -81,7 +81,6 @@ public function buildRepository(
RelationProcessor $relationProcessor,
FieldTypeRegistry $fieldTypeRegistry,
PasswordHashService $passwordHashService,
ThumbnailStrategy $thumbnailStrategy,
ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory,
Mapper\ContentDomainMapper $contentDomainMapper,
Mapper\ContentTypeDomainMapper $contentTypeDomainMapper,
Expand All @@ -95,6 +94,7 @@ public function buildRepository(
PasswordValidatorInterface $passwordValidator,
ConfigResolverInterface $configResolver,
NameSchemaServiceInterface $nameSchemaService,
TransactionHandler $transactionHandler
): Repository {
$config = $this->repositoryConfigurationProvider->getRepositoryConfig();

Expand All @@ -105,7 +105,6 @@ public function buildRepository(
$relationProcessor,
$fieldTypeRegistry,
$passwordHashService,
$thumbnailStrategy,
$proxyDomainMapperFactory,
$contentDomainMapper,
$contentTypeDomainMapper,
Expand All @@ -120,6 +119,7 @@ public function buildRepository(
$passwordValidator,
$configResolver,
$nameSchemaService,
$transactionHandler,
[
'role' => [
'policyMap' => $this->policyMap,
Expand Down
1 change: 1 addition & 0 deletions src/bundle/Core/Command/CleanupVersionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$contentInfo,
$removeAll ? null : $this->mapStatusToVersionInfoStatus($status)
);
$versions = iterator_to_array($versions);
$versionsCount = count($versions);

$output->writeln(sprintf(
Expand Down
66 changes: 24 additions & 42 deletions src/bundle/Core/Command/ReindexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Ibexa\Contracts\Core\Persistence\Content\Location\Handler;
use Ibexa\Contracts\Core\Search\Content\IndexerGateway;
use Ibexa\Core\Base\Exceptions\InvalidArgumentException;
use Ibexa\Core\Search\Common\IncrementalIndexer;
use Ibexa\Core\Search\Common\Indexer;
use Psr\Log\LoggerInterface;
use RuntimeException;
Expand Down Expand Up @@ -191,48 +190,31 @@ protected function execute(InputInterface $input, OutputInterface $output): int
throw new InvalidArgumentException('--iteration-count', "The value must be > 0, you provided '{$iterationCount}'");
}

if (!$this->searchIndexer instanceof IncrementalIndexer) {
$output->writeln(<<<EOT
DEPRECATED:
Running indexing against an Indexer that has not been updated to use IncrementalIndexer abstract.
Options that won't be taken into account:
- since
- content-ids
- subtree
- processes
- no-purge
EOT);
$this->searchIndexer->createSearchIndex($output, (int) $iterationCount, !$commit);
} else {
if (\in_array($input->getOption('processes'), ['0', '1'])) {
$io = new SymfonyStyle($input, $output);
$xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled';
$memoryLimit = ini_get('memory_limit');

$io->warning(<<<EOT
It's not recommended to run this command in a single process mode with a large dataset!
For optimal performance, before running this command, make sure that:
- the xdebug extension is disabled (you have it $xdebugState),
- you're running the command in "prod" environment (default: dev),
- memory limit for big databases is set to "-1" or an adequately high value (your value: $memoryLimit),
- --iteration-count is low enough (default: 50),
- number of processes for parallel batch operations is high enough (default: 'auto' is a good choice).
EOT);

if (!$io->confirm('Continue?', true)) {
return self::SUCCESS;
}
}
if (\in_array($input->getOption('processes'), ['0', '1'])) {
$io = new SymfonyStyle($input, $output);
$xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled';
$memoryLimit = ini_get('memory_limit');

$io->warning(<<<EOT
It's not recommended to run this command in a single process mode with a large dataset!
$output->writeln('Re-indexing started for search engine: ' . $this->searchIndexer->getName());
$output->writeln('');
For optimal performance, before running this command, make sure that:
- the xdebug extension is disabled (you have it $xdebugState),
- you're running the command in "prod" environment (default: dev),
- memory limit for big databases is set to "-1" or an adequately high value (your value: $memoryLimit),
- --iteration-count is low enough (default: 50),
- number of processes for parallel batch operations is high enough (default: 'auto' is a good choice).
EOT);

return $this->indexIncrementally($input, $output, $iterationCount, $commit);
if (!$io->confirm('Continue?', true)) {
return self::SUCCESS;
}
}

return self::SUCCESS;
$output->writeln('Re-indexing started for search engine: ' . get_class($this->searchIndexer));
$output->writeln('');

return $this->indexIncrementally($input, $output, $iterationCount, $commit);
}

/**
Expand All @@ -253,7 +235,7 @@ protected function indexIncrementally(

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

return 0;
return self::SUCCESS;
}

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

return 1;
return self::FAILURE;
}

$iterations = ceil($count / $iterationCount);
Expand Down Expand Up @@ -326,7 +308,7 @@ protected function indexIncrementally(
// clear leftover progress bar parts
$progress->clear();

return 0;
return self::SUCCESS;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function reindex()
try {
// In case version has changed we make sure to fetch fresh ContentInfo
$contentInfo = $contentHandler->loadContentInfo($contentInfo->id);
if ($contentInfo->isPublished) {
if ($contentInfo->status === ContentInfo::STATUS_PUBLISHED) {
$this->searchHandler->indexContent(
$contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo)
);
Expand All @@ -109,7 +109,7 @@ public function reindex()
try {
// In case version has changed we make sure to fetch fresh ContentInfo
$contentInfo = $contentHandler->loadContentInfo($location->contentId);
if ($contentInfo->isPublished) {
if ($contentInfo->status === ContentInfo::STATUS_PUBLISHED) {
$this->searchHandler->indexContent(
$contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo)
);
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Core/Resources/config/helpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- "@?logger"

Ibexa\Core\Helper\FieldHelper:
arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.content_type', '@ibexa.api.service.field_type']
arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.field_type']

Ibexa\Core\Helper\ContentPreviewHelper:
arguments: ["@event_dispatcher", '@Ibexa\Core\MVC\Symfony\SiteAccess\Router']
Expand Down
9 changes: 0 additions & 9 deletions src/contracts/Persistence/Bookmark/Bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ class Bookmark extends ValueObject
*/
public $id;

/**
* Name of the bookmarked location.
*
* @deprecated Property is here purely for BC with 5.x.
*
* @var string
*/
public $name;

/**
* ID of the bookmarked Location.
*
Expand Down
9 changes: 0 additions & 9 deletions src/contracts/Persistence/Bookmark/CreateStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@

class CreateStruct extends ValueObject
{
/**
* Name of the bookmarked location.
*
* @deprecated Property is here purely for BC with 5.x.
*
* @var string
*/
public $name;

/**
* ID of the bookmarked Location.
*
Expand Down
12 changes: 0 additions & 12 deletions src/contracts/Persistence/Content/ContentInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class ContentInfo extends ValueObject
public const STATUS_PUBLISHED = 1;
public const STATUS_TRASHED = 2;

/** @deprecated Use {@see ContentInfo::STATUS_TRASHED} */
public const STATUS_ARCHIVED = self::STATUS_TRASHED;

/**
* Content's unique ID.
*
Expand Down Expand Up @@ -59,15 +56,6 @@ class ContentInfo extends ValueObject
*/
public $currentVersionNo;

/**
* @deprecated Use {@see ContentInfo::$status} (with value {@see ContentInfo::STATUS_PUBLISHED})
*
* Flag indicating if content is currently published.
*
* @var bool
*/
public $isPublished;

/**
* Content owner's id.
*
Expand Down
16 changes: 0 additions & 16 deletions src/contracts/Persistence/Content/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,6 @@ public function loadRelation(int $relationId): Relation;
*/
public function removeRelation($relationId, $type, ?int $destinationContentId = null);

/**
* Loads relations from $sourceContentId. Optionally, loads only those with $type and $sourceContentVersionNo.
*
* @deprecated 4.5.7 It will be removed in 5.0. Use {@see \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList()} instead.
*
* @param mixed $sourceContentId Source Content ID
* @param mixed|null $sourceContentVersionNo Source Content Version, null if not specified
* @param int|null $type {@see \Ibexa\Contracts\Core\Repository\Values\Content\Relation::COMMON,
* \Ibexa\Contracts\Core\Repository\Values\Content\Relation::EMBED,
* \Ibexa\Contracts\Core\Repository\Values\Content\Relation::LINK,
* \Ibexa\Contracts\Core\Repository\Values\Content\Relation::FIELD}
*
* @return \Ibexa\Contracts\Core\Persistence\Content\Relation[]
*/
public function loadRelations($sourceContentId, $sourceContentVersionNo = null, $type = null);

/**
* Counts all outgoing relations for the given version.
*/
Expand Down
49 changes: 0 additions & 49 deletions src/contracts/Persistence/Content/LoadStruct.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/contracts/Persistence/Content/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@ class Location extends ValueObject
*/
public $parentId;

/**
* Legacy format of the url alias.
*
* This field might be removed in a later version.
*
* @deprecated Since 5.4, planned to be removed in 6.0
*
* @var string
*/
public $pathIdentificationString;

/**
* The materialized path of the location entry, eg: /1/2/.
*
Expand Down
11 changes: 0 additions & 11 deletions src/contracts/Persistence/Content/Location/CreateStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ class CreateStruct extends ValueObject
*/
public $contentVersion;

/**
* Legacy format of the url alias.
*
* This field might be removed in a later version.
*
* @deprecated Since 5.4, planned to be removed in 6.0
*
* @var string
*/
public $pathIdentificationString;

/**
* Identifier of the main location.
*
Expand Down
13 changes: 0 additions & 13 deletions src/contracts/Persistence/Content/Location/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,6 @@ public function getSubtreeSize(string $path): int;
*/
public function move($sourceId, $destinationParentId);

/**
* Marks the given nodes and all ancestors as modified.
*
* Optionally a time stamp with the modification date may be specified,
* otherwise the current time is used.
*
* @deprecated As of 6.8, not been used by repository since 5.x.
*
* @param int|string $locationId
* @param int $timestamp
*/
public function markSubtreeModified($locationId, $timestamp = null);

/**
* Sets a location to be hidden, and it self + all children to invisible.
*
Expand Down
5 changes: 2 additions & 3 deletions src/contracts/Persistence/Content/Location/Trash/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Ibexa\Contracts\Core\Persistence\Content\Location\Trash;

use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface;

/**
* The Trash Handler interface defines operations on Location elements in the storage engine.
Expand Down Expand Up @@ -65,14 +65,13 @@ public function recover($trashedId, $newParentId);
* TrashResult->totalCount will ignore limit and offset and representing the total amount of trashed items
* matching the criterion.
*
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|null $criterion
* @param int $offset Offset to start listing from, 0 by default
* @param int $limit Limit for the listing. Null by default (no limit)
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] $sort
*
* @return \Ibexa\Contracts\Core\Persistence\Content\Location\Trashed[]|\Ibexa\Contracts\Core\Persistence\Content\Location\Trash\TrashResult
*/
public function findTrashItems(Criterion $criterion = null, $offset = 0, $limit = null, array $sort = null);
public function findTrashItems(CriterionInterface $criterion = null, $offset = 0, $limit = null, array $sort = null);

/**
* Empties the trash
Expand Down
Loading

0 comments on commit 625f7b7

Please sign in to comment.