diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a951f..1e88a14 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## Unreleased +## 2.0.0-beta.1 - 2022-08-23 +### Added +- Support for Craft 4 + + ## 1.5.1 – 2022-08-23 ### Fixed - Fix an incorrect default value for the `highlight.pre_tags` & diff --git a/composer.json b/composer.json index 90532b9..c9172f4 100755 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } ], "require": { - "craftcms/cms": "^3.5.0", + "craftcms/cms": "^4.0.0", "yiisoft/yii2-elasticsearch": "^2.1.0" }, "autoload": { diff --git a/src/Elasticsearch.php b/src/Elasticsearch.php index e81fa8f..f91acbe 100755 --- a/src/Elasticsearch.php +++ b/src/Elasticsearch.php @@ -60,7 +60,7 @@ class Elasticsearch extends Plugin public const EVENT_ERROR_NO_ATTACHMENT_PROCESSOR = 'errorNoAttachmentProcessor'; public const PLUGIN_HANDLE = 'elasticsearch'; - public $hasCpSettings = true; + public bool $hasCpSettings = true; public function init(): void { diff --git a/src/controllers/CpController.php b/src/controllers/CpController.php index 1e21d5a..8e5e7b5 100644 --- a/src/controllers/CpController.php +++ b/src/controllers/CpController.php @@ -28,7 +28,8 @@ class CpController extends Controller { /** @var ElasticsearchPlugin */ public $plugin; - public $allowAnonymous = ['testConnection', 'reindexPerformAction']; + + protected array|bool|int $allowAnonymous = ['testConnection', 'reindexPerformAction']; public function init(): void { @@ -169,7 +170,7 @@ protected function getSiteIds(Request $request): array * @throws \Exception If reindexing the entry fails for some reason. * @throws \yii\web\BadRequestHttpException if the request body is missing a `params` property */ - protected function reindexElement() + protected function reindexElement(): ?string { $request = Craft::$app->getRequest(); diff --git a/src/jobs/IndexElementJob.php b/src/jobs/IndexElementJob.php index 2329eee..0eafcf3 100755 --- a/src/jobs/IndexElementJob.php +++ b/src/jobs/IndexElementJob.php @@ -32,7 +32,7 @@ class IndexElementJob extends BaseJob /** * @inheritdoc */ - public function execute($queue) + public function execute($queue): void { $sites = Craft::$app->getSites(); $site = $sites->getSiteById($this->siteId); diff --git a/src/services/ElementIndexerService.php b/src/services/ElementIndexerService.php index 365c95f..04a7466 100755 --- a/src/services/ElementIndexerService.php +++ b/src/services/ElementIndexerService.php @@ -218,6 +218,7 @@ protected function getElementIndexableContent(Element $element) 'preview/preview', [ 'elementType' => get_class($element), + 'canonicalId' => $element->canonicalId, 'sourceId' => $element->id, 'siteId' => $element->siteId, 'draftId' => null, diff --git a/src/utilities/RefreshElasticsearchIndexUtility.php b/src/utilities/RefreshElasticsearchIndexUtility.php index b650ce9..e0e25f6 100755 --- a/src/utilities/RefreshElasticsearchIndexUtility.php +++ b/src/utilities/RefreshElasticsearchIndexUtility.php @@ -46,7 +46,7 @@ public static function id(): string * Returns the path to the utility's SVG icon. * @return string|null The path to the utility SVG icon */ - public static function iconPath() + public static function iconPath(): ?string { return Craft::getAlias('@lhs/elasticsearch/resources/cp/img/utility-icon.svg'); }