Skip to content

Typo3 13 compatibility #22

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

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ jobs:

matrix:
php:
- '8.1'
- '8.2'
- '8.3'

2 changes: 1 addition & 1 deletion Classes/Command/NotifySearchEngineCommand.php
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$errors = 0;
foreach ($this->stackRepository->findAll() as $urlRecord) {
$total++;
$url = trim($urlRecord['url']);
$url = trim($urlRecord['url'] ?? '');

if ($url === '') {
$this->stackRepository->deleteByUid((int)$urlRecord['uid']);
3 changes: 2 additions & 1 deletion Classes/Domain/Repository/StackRepository.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@

namespace JWeiland\IndexNow\Domain\Repository;

use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;

/**
@@ -43,7 +44,7 @@ public function deleteByUid(int $uid): void
->where(
$this->queryBuilder->expr()->eq(
'uid',
$this->queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
$this->queryBuilder->createNamedParameter($uid, Connection::PARAM_INT)
)
)
->executeStatement();
21 changes: 6 additions & 15 deletions Classes/Event/ModifyPageUidEvent.php
Original file line number Diff line number Diff line change
@@ -17,27 +17,18 @@
*/
class ModifyPageUidEvent
{
private array $record;

private string $table;

private int $pageUid;

private ?array $pageRecord;

/**
* @param array $record This is the record, which is requested to be stored. Coming from DataHandler.
* @param string $table This is the table name where the record will be stored
* @param int $pageUid This is the page UID. We will use it to create a preview URL for IndexNow request. Set it to 0 to prevent informing IndexNow.
* @param array|null $pageRecord To keep your life easy we provide you the full page record. Be careful, in rare cases it can be NULL!
*/
public function __construct(array $record, string $table, int $pageUid, ?array $pageRecord)
{
$this->record = $record;
$this->table = $table;
$this->pageUid = $pageUid;
$this->pageRecord = $pageRecord;
}
public function __construct(
private readonly array $record,
private readonly string $table,
private int $pageUid,
private readonly ?array $pageRecord
) {}

public function getRecord(): array
{
4 changes: 2 additions & 2 deletions Classes/Hook/DataHandlerHook.php
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ public function processDatamap_beforeStart(DataHandler $dataHandler): void
$this->stackRepository->insert(
$this->getUrlForSearchEngineEndpoint($url)
);
} catch (ApiKeyNotAvailableException $apiKeyNotAvailableException) {
} catch (ApiKeyNotAvailableException) {
$this->sendBackendNotification(
'Missing API key',
'Please set an API key for EXT:indexnow in extension settings',
@@ -129,7 +129,7 @@ protected function getPreviewUrl(int $pageUid): ?string
->withAdditionalQueryParameters($additionalParams)
->buildUri()
);
} catch (UnableToLinkToPageException $e) {
} catch (UnableToLinkToPageException) {
return null;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
}
],
"require": {
"typo3/cms-core": "^12.4.15"
"typo3/cms-core": "^12.4.15 || ^13.4.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.44",
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -14,10 +14,10 @@
'author' => 'Stefan Froemken',
'author_email' => 'sfroemken@jweiland.net',
'state' => 'experimental',
'version' => '0.0.5',
'version' => '0.0.6',
'constraints' => [
'depends' => [
'typo3' => '12.4.15-12.4.99',
'typo3' => '12.4.15-13.4.99',
],
'conflicts' => [],
'suggests' => [],
10 changes: 7 additions & 3 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -7,16 +7,20 @@
* LICENSE file that was distributed with this source code.
*/

use JWeiland\IndexNow\Hook\DataHandlerHook;
use Psr\Log\LogLevel;
use TYPO3\CMS\Core\Log\Writer\FileWriter;

if (!defined('TYPO3')) {
die('Access denied.');
}

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['indexnow']
= \JWeiland\IndexNow\Hook\DataHandlerHook::class;
= DataHandlerHook::class;

$GLOBALS['TYPO3_CONF_VARS']['LOG']['JWeiland']['IndexNow']['writerConfiguration'] = [
\Psr\Log\LogLevel::WARNING => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
LogLevel::WARNING => [
FileWriter::class => [
'logFileInfix' => 'indexnow',
],
],
Loading