diff --git a/Classes/Command/NotifySearchEngineCommand.php b/Classes/Command/NotifySearchEngineCommand.php index bd4789c..5ad13d5 100644 --- a/Classes/Command/NotifySearchEngineCommand.php +++ b/Classes/Command/NotifySearchEngineCommand.php @@ -60,8 +60,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->stackRepository->deleteByUid($stack->getUid()); } - $this->logger->info(sprintf('Batch sent (%d URLs), all entries deleted', count($uids))); - $output->writeln(sprintf('Batch sent (%d URLs), all entries deleted.', count($uids))); + $this->logger->info(sprintf('Batch sent (%d URLs), all entries deleted', $stackStorage->count())); + $output->writeln(sprintf('Batch sent (%d URLs), all entries deleted.', $stackStorage->count())); return self::SUCCESS; } diff --git a/Classes/Notifier/SearchEngineNotifier.php b/Classes/Notifier/SearchEngineNotifier.php index 7273a35..33ccd80 100644 --- a/Classes/Notifier/SearchEngineNotifier.php +++ b/Classes/Notifier/SearchEngineNotifier.php @@ -105,18 +105,18 @@ protected function notifySingleStack(Stack $stack): bool return $isValidRequest; } + /** + * @throws ApiKeyNotAvailableException + */ protected function getUrlForSingleNotification(Stack $stack): string { + // Do not surround with try-catch. It should break in scheduler/cli + // if no API key is available to inform the user visually $uri = new Uri($this->extConf->getSearchEngineEndpoint()); - - try { - $uri = $uri->withQuery(HttpUtility::buildQueryString([ - 'url' => $stack->getUrl(), - 'key' => $this->extConf->getApiKey(), - ])); - } catch (ApiKeyNotAvailableException) { - return ''; - } + $uri = $uri->withQuery(HttpUtility::buildQueryString([ + 'url' => $stack->getUrl(), + 'key' => $this->extConf->getApiKey(), + ])); return (string)$uri; } diff --git a/Resources/Private/Language/ExtConf.xlf b/Resources/Private/Language/ExtConf.xlf index fe4ec7c..046a0f1 100644 --- a/Resources/Private/Language/ExtConf.xlf +++ b/Resources/Private/Language/ExtConf.xlf @@ -7,14 +7,11 @@ API Key: Each request needs an API key to identify your URLs. You can build one here: https://www.bing.com/indexnow - Search Engine Endpoint: Define the index-now URL of searchengine which should be used to inform about modified content. Use ###URL### and ###APIKEY### for dynamic values. - - - Enable debug mode: In case of problems it can help to activate the debug mode. In this case, additional information is displayed in the backend, such as the URL that is sent to the search engines. + Search Engine Endpoint: Define the index-now URL of searchengine which should be used to inform about modified content. Notify batch mode: if enabled, the search engine will be notified using batch mode. This means that modified URLs are sent in a single request. A maximum of 10,000 URLs can be sent per batch. - \ No newline at end of file + diff --git a/Resources/Private/Language/de.ExtConf.xlf b/Resources/Private/Language/de.ExtConf.xlf index b529021..d17d98c 100644 --- a/Resources/Private/Language/de.ExtConf.xlf +++ b/Resources/Private/Language/de.ExtConf.xlf @@ -9,11 +9,7 @@ Search Engine Endpoint: Define the index-now URL of searchengine which should be used to inform about modified content. Use ###URL### and ###APIKEY### for dynamic values. - Endpunkt der Suchmaschine: Geben Sie hier die index-now URL zum Suchmaschinenanbieter an, um ihn über aktualisierte Inhalte zu informieren. Verwende ###URL### und ###APIKEY### als dynamische Werte. - - - Enable debug mode: In case of problems it can help to activate the debug mode. In this case, additional information is displayed in the backend, such as the URL that is sent to the search engines. - Debug Modus aktivieren: Bei Problemen kann es helfen des Debug Modus zu aktivieren. In diesem Falle werden zusätzliche Informationen im Backend ausgegeben, wie z.B. die URL, die an die Suchmaschinen gesendet wird. + Endpunkt der Suchmaschine: Geben Sie hier die index-now URL zum Suchmaschinenanbieter an, um ihn über aktualisierte Inhalte zu informieren. If this checkbox is enabled, the search engine will be notified using batch mode. This means that modified URLs are sent in a single request. A maximum of 10,000 URLs can be sent per batch. @@ -21,4 +17,4 @@ - \ No newline at end of file + diff --git a/ext_conf_template.txt b/ext_conf_template.txt index 14c7986..2fcecf5 100644 --- a/ext_conf_template.txt +++ b/ext_conf_template.txt @@ -2,7 +2,5 @@ apiKey = # cat=basic; type=string; label=LLL:EXT:indexnow/Resources/Private/Language/ExtConf.xlf:searchEngineEndpoint searchEngineEndpoint = https://www.bing.com/indexnow -# cat=basic; type=boolean; label=LLL:EXT:indexnow/Resources/Private/Language/ExtConf.xlf:enableDebug -enableDebug = 0 # cat=basic; type=boolean; label=LLL:EXT:indexnow/Resources/Private/Language/ExtConf.xlf:notifyBatchMode notifyBatchMode = 0 diff --git a/ext_emconf.php b/ext_emconf.php index dbf10a5..05df328 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'author' => 'Stefan Froemken', 'author_email' => 'sfroemken@jweiland.net', 'state' => 'experimental', - 'version' => '0.0.7', + 'version' => '0.0.8', 'constraints' => [ 'depends' => [ 'typo3' => '12.4.31-13.4.99',