Skip to content

Commit a800188

Browse files
authored
Merge branch '4.6' into main
2 parents 31835d7 + 7e8c8ec commit a800188

File tree

49 files changed

+1619
-12
lines changed

Some content is hidden

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

49 files changed

+1619
-12
lines changed

.github/workflows/browser-tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ jobs:
1717
test-suite: "--mode=standard --profile=core --tags='~@broken&&~@setup'"
1818
secrets:
1919
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
20+
AUTOMATION_CLIENT_ID: ${{ secrets.AUTOMATION_CLIENT_ID }}
21+
AUTOMATION_CLIENT_INSTALLATION: ${{ secrets.AUTOMATION_CLIENT_INSTALLATION }}
22+
AUTOMATION_CLIENT_SECRET: ${{ secrets.AUTOMATION_CLIENT_SECRET }}

phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19020,6 +19020,12 @@ parameters:
1902019020
count: 1
1902119021
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/DateMetadata.php
1902219022

19023+
-
19024+
message: '#^Cannot access an offset on list\|string\|false\.$#'
19025+
identifier: offsetAccess.nonOffsetAccessible
19026+
count: 1
19027+
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php
19028+
1902319029
-
1902419030
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Common\\Gateway\\CriterionHandler\\Field\:\:getFieldsInformation\(\) return type has no value type specified in iterable type array\.$#'
1902519031
identifier: missingType.iterableValue

src/bundle/Core/Command/ResizeOriginalImagesCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Ibexa\Contracts\Core\Repository\UserService;
1717
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
1818
use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit;
19+
use Ibexa\Core\Base\Exceptions\InvalidArgumentValue;
1920
use Ibexa\Core\FieldType\Image\Value;
2021
use Ibexa\Core\IO\IOServiceInterface;
2122
use Ibexa\Core\IO\Values\BinaryFile;
@@ -290,7 +291,7 @@ private function resize(OutputInterface $output, SearchHit $hit, string $imageFi
290291
* @param \Ibexa\Core\FieldType\Image\Value $image
291292
*
292293
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException
293-
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentValue
294+
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
294295
*
295296
* @return \Ibexa\Core\IO\Values\BinaryFile
296297
*/
@@ -299,6 +300,10 @@ private function store(BinaryInterface $binary, Value $image): BinaryFile
299300
$tmpFile = tmpfile();
300301
fwrite($tmpFile, $binary->getContent());
301302
$tmpMetadata = stream_get_meta_data($tmpFile);
303+
if (!isset($tmpMetadata['uri'])) {
304+
throw new InvalidArgumentValue('uri', '', BinaryInterface::class);
305+
}
306+
302307
$binaryCreateStruct = $this->ioService->newBinaryCreateStructFromLocalFile($tmpMetadata['uri']);
303308
$binaryCreateStruct->id = $image->id;
304309
$newBinaryFile = $this->ioService->createBinaryFile($binaryCreateStruct);

src/bundle/Core/Imagine/IORepositoryResolver.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Ibexa\Bundle\Core\Variation\PathResolver;
1111
use Ibexa\Contracts\Core\Variation\VariationPathGenerator;
1212
use Ibexa\Contracts\Core\Variation\VariationPurger;
13+
use Ibexa\Core\Base\Exceptions\InvalidArgumentValue;
1314
use Ibexa\Core\Base\Exceptions\NotFoundException;
1415
use Ibexa\Core\IO\IOServiceInterface;
1516
use Ibexa\Core\IO\Values\MissingBinaryFile;
@@ -72,14 +73,21 @@ public function resolve($path, $filter): string
7273
/**
7374
* Stores image alias in the IO Repository.
7475
* A temporary file is created to dump the filtered image and is used as basis for creation in the IO Repository.
76+
*
77+
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
7578
*/
7679
public function store(BinaryInterface $binary, $path, $filter): void
7780
{
7881
$tmpFile = tmpfile();
7982
fwrite($tmpFile, $binary->getContent());
8083
$tmpMetadata = stream_get_meta_data($tmpFile);
8184

85+
if (!isset($tmpMetadata['uri'])) {
86+
throw new InvalidArgumentValue('uri', '', BinaryInterface::class);
87+
}
88+
8289
$binaryCreateStruct = $this->ioService->newBinaryCreateStructFromLocalFile($tmpMetadata['uri']);
90+
8391
$binaryCreateStruct->id = $this->getFilePath($path, $filter);
8492
$this->ioService->createBinaryFile($binaryCreateStruct);
8593

src/bundle/Core/Imagine/PlaceholderProvider/GenericProvider.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Ibexa\Bundle\Core\Imagine\PlaceholderProvider;
99

1010
use Ibexa\Bundle\Core\Imagine\PlaceholderProvider;
11+
use Ibexa\Core\Base\Exceptions\InvalidArgumentValue;
1112
use Ibexa\Core\FieldType\Image\Value as ImageValue;
1213
use Imagine\Image as Image;
1314
use Imagine\Image\ImagineInterface;
@@ -83,9 +84,17 @@ private function getPlaceholderText(string $pattern, ImageValue $value): string
8384
]);
8485
}
8586

87+
/**
88+
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentValue
89+
*/
8690
private function getTemporaryPath(): string
8791
{
88-
return stream_get_meta_data(tmpfile())['uri'];
92+
$path = stream_get_meta_data(tmpfile())['uri'] ?? null;
93+
if ($path === null) {
94+
throw new InvalidArgumentValue('uri', '');
95+
}
96+
97+
return $path;
8998
}
9099

91100
private function resolveOptions(array $options): array

src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Ibexa\Bundle\Core\Imagine\PlaceholderProvider;
99

1010
use Ibexa\Bundle\Core\Imagine\PlaceholderProvider;
11+
use Ibexa\Core\Base\Exceptions\InvalidArgumentValue;
1112
use Ibexa\Core\FieldType\Image\Value as ImageValue;
1213
use RuntimeException;
1314
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -58,7 +59,12 @@ private function getPlaceholderUrl(string $urlPattern, ImageValue $value): strin
5859

5960
private function getTemporaryPath(): string
6061
{
61-
return stream_get_meta_data(tmpfile())['uri'];
62+
$path = stream_get_meta_data(tmpfile())['uri'] ?? null;
63+
if ($path === null) {
64+
throw new InvalidArgumentValue('uri', '');
65+
}
66+
67+
return $path;
6268
}
6369

6470
private function resolveOptions(array $options): array
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/**
4+
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5+
* @license For full copyright and license information view LICENSE file distributed with this source code.
6+
*/
7+
declare(strict_types=1);
8+
9+
namespace Ibexa\Contracts\Core\Persistence\Content\Type;
10+
11+
use Doctrine\DBAL\Query\QueryBuilder;
12+
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
13+
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
14+
15+
/**
16+
* @template TCriterion of \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface
17+
*/
18+
interface CriterionHandlerInterface
19+
{
20+
/**
21+
* @phpstan-param TCriterion $criterion
22+
*/
23+
public function supports(CriterionInterface $criterion): bool;
24+
25+
/**
26+
* @phpstan-param TCriterion $criterion
27+
*
28+
* @return string|\Doctrine\DBAL\Query\Expression\CompositeExpression
29+
*/
30+
public function apply(
31+
CriterionVisitor $criterionVisitor,
32+
QueryBuilder $qb,
33+
CriterionInterface $criterion
34+
);
35+
}

src/contracts/Persistence/Content/Type/Handler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Ibexa\Contracts\Core\Persistence\Content\Type;
1111
use Ibexa\Contracts\Core\Persistence\Content\Type\Group\CreateStruct as GroupCreateStruct;
1212
use Ibexa\Contracts\Core\Persistence\Content\Type\Group\UpdateStruct as GroupUpdateStruct;
13+
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
1314

1415
interface Handler
1516
{
@@ -92,6 +93,13 @@ public function loadContentTypes($groupId, $status = Type::STATUS_DEFINED);
9293
*/
9394
public function loadContentTypeList(array $contentTypeIds): array;
9495

96+
/**
97+
* @param list<string> $prioritizedLanguages Used as prioritized language code on translated properties of returned object.
98+
*
99+
* @return array{count: int, items: array<string, mixed>}
100+
*/
101+
public function findContentTypes(?ContentTypeQuery $query = null, array $prioritizedLanguages = []): array;
102+
95103
/**
96104
* @return \Ibexa\Contracts\Core\Persistence\Content\Type[]
97105
*/

src/contracts/Repository/ContentTypeService.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
1919
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct;
2020
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct;
21+
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
22+
use Ibexa\Contracts\Core\Repository\Values\ContentType\SearchResult;
2123
use Ibexa\Contracts\Core\Repository\Values\User\User;
2224

2325
interface ContentTypeService
@@ -173,6 +175,11 @@ public function loadContentTypeDraft(int $contentTypeId, bool $ignoreOwnership =
173175
*/
174176
public function loadContentTypeList(array $contentTypeIds, array $prioritizedLanguages = []): iterable;
175177

178+
/**
179+
* @param list<string> $prioritizedLanguages Used as prioritized language code on translated properties of returned object.
180+
*/
181+
public function findContentTypes(?ContentTypeQuery $query = null, array $prioritizedLanguages = []): SearchResult;
182+
176183
/**
177184
* Get content type objects which belong to the given content type group.
178185
*

src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
2020
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct;
2121
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct;
22+
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
23+
use Ibexa\Contracts\Core\Repository\Values\ContentType\SearchResult;
2224
use Ibexa\Contracts\Core\Repository\Values\User\User;
2325

2426
abstract class ContentTypeServiceDecorator implements ContentTypeService
@@ -106,6 +108,11 @@ public function loadContentTypeList(
106108
return $this->innerService->loadContentTypeList($contentTypeIds, $prioritizedLanguages);
107109
}
108110

111+
public function findContentTypes(?ContentTypeQuery $query = null, array $prioritizedLanguages = []): SearchResult
112+
{
113+
return $this->innerService->findContentTypes($query, $prioritizedLanguages);
114+
}
115+
109116
public function loadContentTypes(
110117
ContentTypeGroup $contentTypeGroup,
111118
array $prioritizedLanguages = []

0 commit comments

Comments
 (0)