Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8534: Cleaned up deprecations - batch 2 #456

Merged
merged 36 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
441fe55
Undeprecated SectionService::countAssignedContents as it is used by a…
ViniTou Sep 20, 2024
fac457a
dropped \Ibexa\Core\Helper\FieldHelper::getFieldDefinition
ViniTou Sep 23, 2024
56fede6
dropped \Ibexa\Core\FieldType\StorageGateway
ViniTou Sep 23, 2024
6bf3701
dropped \Ibexa\Contracts\Core\Persistence\Content\ContentInfo::STATUS…
ViniTou Sep 23, 2024
d6837f8
dropped \Ibexa\Contracts\Core\Persistence\Content\ContentInfo::$isPub…
ViniTou Sep 23, 2024
330d764
dropped $name from bookmarks
ViniTou Sep 26, 2024
f9538e8
dropped \Ibexa\Contracts\Core\Persistence\Content\Handler::loadRelations
ViniTou Sep 27, 2024
e603ba4
dropped Identity contracts
ViniTou Oct 1, 2024
f32bb8e
undeprecated count in Section method
ViniTou Oct 1, 2024
d09af34
Inject TransactionHandler into repository
ViniTou Oct 1, 2024
ca01544
dropped imageValue::path
ViniTou Oct 1, 2024
395e685
dropped imageValue::path
ViniTou Oct 2, 2024
66ea9d7
dropped \Ibexa\Core\FieldType\Image\Value::fromString
ViniTou Oct 2, 2024
dc6f034
dropped \Ibexa\Contracts\Core\Persistence\Content\LoadStruct
ViniTou Oct 2, 2024
1ff0dfd
dropped \Ibexa\Core\Persistence\Cache\PersistenceLogger::getCount
ViniTou Oct 2, 2024
33d4026
dropped \Ibexa\Contracts\Core\Repository\PasswordHashService
ViniTou Oct 2, 2024
23ca5e9
Revert "dropped \Ibexa\Core\FieldType\Image\Value::fromString"
ViniTou Oct 2, 2024
bc2dfc0
undeprecated fromString method
ViniTou Oct 2, 2024
0104223
dropped Location::pathIdentificationString
ViniTou Oct 2, 2024
bba863f
dropped markSubtreeModified & updateSubtreeModificationTime
ViniTou Oct 7, 2024
70608da
dropped \Ibexa\Contracts\Core\Persistence\FieldType\IsEmptyValue
ViniTou Oct 8, 2024
c873aa8
dropped Indexer::createSearchIndex
ViniTou Oct 8, 2024
29eee9f
dropped \Ibexa\Contracts\Core\Persistence\User\Handler::loadPoliciesB…
ViniTou Oct 8, 2024
9fc82f1
dropped \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criteri…
ViniTou Oct 8, 2024
4d27bdd
dropped \Ibexa\Core\Repository\Helper\RoleDomainMapper
ViniTou Oct 8, 2024
97d9c77
dropped Ibexa\Core\Repository\Helper\NameSchemaService
ViniTou Oct 8, 2024
91354c2
dropped \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criteri…
ViniTou Oct 8, 2024
184aa81
dropped Location::SORT_FIELD_MODIFIED_SUBNODE
ViniTou Oct 8, 2024
592aabb
replaced abstract Criterion with CriterionInterface
ViniTou Oct 9, 2024
97ac334
Fixed Deprecations related code after rebase
ViniTou Nov 19, 2024
fa189c2
Fixed RepositoryFactory
ViniTou Nov 19, 2024
8f97013
Fixed phpstan issues mostly related to Criterion interface - all othe…
ViniTou Nov 20, 2024
1440e9c
Cleanup baseline
ViniTou Nov 20, 2024
fcad8a1
Fixed typing in PermissionCriterionResolver
ViniTou Nov 26, 2024
e2bc6e4
Added typehint to Query::query
ViniTou Nov 28, 2024
d935537
Code review fixes - mostly FQCN
ViniTou Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading