From f37b812b1d6051812ebf8d6bbb65bfb1525076dd Mon Sep 17 00:00:00 2001 From: Norbert Micheel Date: Tue, 14 Jan 2025 15:19:35 +0100 Subject: [PATCH] 6.12.1 cronjob to clear search cache --- CHANGELOG.md | 3 +++ boot.php | 1 + lang/de_de.lang | 3 ++- lang/en_gb.lang | 5 +++-- lang/es_es.lang | 3 ++- lang/pt_br.lang | 3 ++- lang/sv_se.lang | 3 ++- lib/command/clearCache.php | 37 +++++++++++++++++++++++++++++++++++++ lib/cronjob_clearcache.php | 35 +++++++++++++++++++++++++++++++++++ package.yml | 3 ++- plugins/stats/package.yml | 2 +- 11 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 lib/command/clearCache.php create mode 100644 lib/cronjob_clearcache.php diff --git a/CHANGELOG.md b/CHANGELOG.md index fb9022a..09f3a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog + +## Version 6.12.1 (2025-01-14) - remove/replace utf8_encode() in statistik PlugIn for PHP 8.2 +- cronjob to clear search cache ## Version 6.11.2 (2024-07-29) - autocomplete Plugin is deprecated, use the new subpage instead diff --git a/boot.php b/boot.php index e3efa2d..9392c79 100644 --- a/boot.php +++ b/boot.php @@ -47,6 +47,7 @@ } if (rex_addon::get('cronjob')->isAvailable() && !rex::isSafeMode()) { rex_cronjob_manager::registerType(rex_cronjob_reindex::class); + rex_cronjob_manager::registerType(rex_cronjob_clearcache::class); } if (rex_request('search_it_build_index', 'string', '') != '') { diff --git a/lang/de_de.lang b/lang/de_de.lang index 97a5876..f157ba7 100644 --- a/lang/de_de.lang +++ b/lang/de_de.lang @@ -84,9 +84,10 @@ search_it_generate_full_text = Die Index-Tabelle wird gelöscht und neu aufgebau search_it_generate_incremental = Index schrittweise erstellen search_it_generate_incremental_text = Bei Problemen mit der maximalen Skriptlaufzeit (max_execution_time) kann der Index schrittweise erstellt werden. search_it_generate_incremental_confirm = Die schrittweise Indexierung starten? -search_it_generate_delete_cache = Suchcache löschen +search_it_generate_delete_cache = Search it: Suchcache löschen search_it_generate_delete_cache_text = Wenn eine Neuindexierung nicht erforderlich ist, kann auch ausschließlich der Cache gelöscht werden. search_it_generate_cache_deleted = Suchcache wurde gelöscht +search_it_generate_cache_deleted_error = Fehler beim Löschen des Suchcaches search_it_generate_delete_keywords = Keyword-Index leeren search_it_generate_delete_keywords_text = Löscht alle Keywords, die bei der Indexierung oder über Suchanfragen gesammelt wurden. Diese Keywords werden unter anderem für die Ähnlichkeitssuche gebraucht und sollten nicht gelöscht werden. search_it_generate_delete_keywords_confirm = Wirklich alle Keywords löschen? diff --git a/lang/en_gb.lang b/lang/en_gb.lang index 70fe361..8eb9b6d 100644 --- a/lang/en_gb.lang +++ b/lang/en_gb.lang @@ -84,9 +84,10 @@ search_it_generate_full_text = Deletes and rebuilds the index table. search_it_generate_incremental = Generate index incrementally search_it_generate_incremental_text = When having problems with maximum execution time the index can be generated incrementally. search_it_generate_incremental_confirm = Start incremental indexing? -search_it_generate_delete_cache = Clear search cache +search_it_generate_delete_cache = Search it: Clear search cache search_it_generate_delete_cache_text = If recreation of the index is not nescessary, the search cache can be deleted exclusively. -search_it_generate_cache_deleted = Search cache cleared +search_it_generate_cache_deleted = Search cache was cleared +search_it_generate_cache_deleted_error = Error while deleting the search cache search_it_generate_delete_keywords = Truncate keyword index search_it_generate_delete_keywords_text = Deletes all keywords collected during the indexing process and with searches. These keywords are nescessary for the fuzzy search and should not be deleted. search_it_generate_delete_keywords_confirm = Do you really want to delete all keywords? diff --git a/lang/es_es.lang b/lang/es_es.lang index 182f5d1..e949efd 100644 --- a/lang/es_es.lang +++ b/lang/es_es.lang @@ -83,9 +83,10 @@ search_it_generate_full_text = La tabla de índice se elimina y se reconstruye. search_it_generate_incremental = Crear índice paso a paso search_it_generate_incremental_text = Para los problemas con el tiempo de ejecución máximo del script (max_execution_time), el índice se puede crear paso a paso. search_it_generate_incremental_confirm = Comience la indexación gradual? -search_it_generate_delete_cache = Eliminar caché de búsqueda +search_it_generate_delete_cache = Search it: Eliminar caché de búsqueda search_it_generate_delete_cache_text = Si no es necesario reindexar, solo se puede eliminar el caché. search_it_generate_cache_deleted = La memoria caché de búsqueda ha sido eliminada +search_it_generate_cache_deleted_error = Error al eliminar la memoria caché de búsqueda search_it_generate_delete_keywords = Índice de palabras clave vacías search_it_generate_delete_keywords_text = Elimina todas las palabras clave recopiladas durante la indexación o mediante consultas de búsqueda. Estas palabras clave se utilizan, entre otras cosas, para la búsqueda de similitud y no se deben eliminar. search_it_generate_delete_keywords_confirm = ¿Realmente borras todas las palabras clave? diff --git a/lang/pt_br.lang b/lang/pt_br.lang index d6fef87..32abd85 100644 --- a/lang/pt_br.lang +++ b/lang/pt_br.lang @@ -83,9 +83,10 @@ search_it_generate_full_text = A tabela de índice será descartada e reconstru search_it_generate_incremental = Criar Index gradualmente search_it_generate_incremental_text = Para problemas com o tempo máximo de execução de script (max_execution_time), o índice pode ser criado gradualmente. search_it_generate_incremental_confirm = Começar a indexação progressiva? -search_it_generate_delete_cache = Limpar cachê de busca +search_it_generate_delete_cache = Search it: Limpar cachê de busca search_it_generate_delete_cache_text = Se um re-indexação não é necessária, o cache também pode ser totalmente excluído. search_it_generate_cache_deleted = Cachê de busca foi apagado +search_it_generate_cache_deleted_error = Erro ao apagar o cache de busca search_it_generate_delete_keywords = Esvaziar o Index de palavras-chave search_it_generate_delete_keywords_text = Apaga todas as palavras-chave que foram coletadas através de indexação ou solicitações de busca. Essas palavras-chave são utilizadas para a busca por similiridade, entre outras, e não devem ser deletadas. search_it_generate_delete_keywords_confirm = Você realmente deseja deletar todas as palavras-chave? diff --git a/lang/sv_se.lang b/lang/sv_se.lang index 9abe69b..e5562f6 100644 --- a/lang/sv_se.lang +++ b/lang/sv_se.lang @@ -83,9 +83,10 @@ search_it_generate_full_text = Raderar och bygger om indextabellen. search_it_generate_incremental = Generera index inkrementellt search_it_generate_incremental_text = När du har problem med maximal körtid (max_execution_time) kan indexet genereras stegvis. search_it_generate_incremental_confirm = Börja inkrementell indexering? -search_it_generate_delete_cache = Rensa sökcachen +search_it_generate_delete_cache = Search it: Rensa sökcachen search_it_generate_delete_cache_text = Om en nyindexering inte är nödvändig kan enbart cachen raderas. search_it_generate_cache_deleted = Sökcachen raderades. +search_it_generate_cache_deleted_error = Fel vid radering av cachen. search_it_generate_delete_keywords = Tömma nyckelord-index search_it_generate_delete_keywords_text = Ta bort alla sökord som samlats in under indexeringsprocessen och/eller med sökningar. Dessa nyckelord är bl.a. nödvändiga för den likhetssökningen och bör inte raderas. search_it_generate_delete_keywords_confirm = Vill du verkligen ta bort alla nyckelord? diff --git a/lib/command/clearCache.php b/lib/command/clearCache.php new file mode 100644 index 0000000..baeaf77 --- /dev/null +++ b/lib/command/clearCache.php @@ -0,0 +1,37 @@ +setDescription(rex_i18n::rawMsg('search_it_generate_delete_cache')); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = $this->getStyle($input, $output); + $io->title('search_it clear cache'); + + $search_it = new search_it(); + $global_return = $search_it->deleteCache(); + + if ($global_return < 4) { + echo $io->success(rex_i18n::rawMsg('search_it_generate_cache_deleted')); + return 0; + } else { + echo $io->error(rex_i18n::rawMsg('search_it_generate_cache_deleted_error')); + } + + return 1; + } +} diff --git a/lib/cronjob_clearcache.php b/lib/cronjob_clearcache.php new file mode 100644 index 0000000..577f7d3 --- /dev/null +++ b/lib/cronjob_clearcache.php @@ -0,0 +1,35 @@ +isAvailable()) { + + //$message = $this->getParam('action').':'."\n"; + + $search_it = new search_it(); + + $search_it->deleteCache(); + + + + //if ( $message != '' ) { $this->setMessage($message); } + return true; + } + $this->setMessage('Search it is not installed'); + return false; + } + + public function getTypeName() + { + return rex_i18n::msg('search_it_generate_delete_cache'); + } + + public function getParamFields() + { + $fields = []; + return $fields; + } +} diff --git a/package.yml b/package.yml index 4e979a7..d232be8 100644 --- a/package.yml +++ b/package.yml @@ -1,5 +1,5 @@ package: search_it -version: '6.11.2' +version: '6.12.1' author: Friends Of REDAXO supportpage: https://github.com/FriendsOfREDAXO/search_it @@ -33,6 +33,7 @@ page: console_commands: search_it:reindex: rex_search_it_command_reindex + search_it:clearCache: rex_search_it_command_clearcache requires: redaxo: '^5.6.0' diff --git a/plugins/stats/package.yml b/plugins/stats/package.yml index a5b3fc5..02102e3 100644 --- a/plugins/stats/package.yml +++ b/plugins/stats/package.yml @@ -1,5 +1,5 @@ package: search_it/stats -version: '6.11.2' +version: '6.12.1' author: Friends Of REDAXO title: 'translate:search_it_stats_plugin_title'