JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

[5.0] Smart Search: Improving error handling of Indexing #354

Closed joomlapl-bot closed 5 months ago

joomlapl-bot commented 1 year ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/39965 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/components/com_finder/src/Controller/IndexerController.php b/administrator/components/com_finder/src/Controller/IndexerController.php index 51a398129a6f..ef51b8b0b2d5 100644 --- a/administrator/components/com_finder/src/Controller/IndexerController.php +++ b/administrator/components/com_finder/src/Controller/IndexerController.php @@ -90,6 +90,12 @@ public function start() $state = Indexer::getState(); $state->start = 1; + $output = ob_get_contents(); + + if ($output) { + throw new \Exception(Text::_('COM_FINDER_AN_ERROR_HAS_OCCURRED')); + } + // Send the response. static::sendResponse($state); } catch (\Exception $e) { @@ -170,6 +176,12 @@ public function batch() // Informational log only } + $output = ob_get_contents(); + + if ($output) { + throw new \Exception(Text::_('COM_FINDER_INDEXER_ERROR_PLUGIN_FAILURE')); + } + // Send the response. static::sendResponse($state); } catch (\Exception $e) { @@ -214,6 +226,12 @@ public function optimize() $state->start = 0; $state->complete = 1; + $output = ob_get_contents(); + + if ($output) { + throw new \Exception(Text::_('COM_FINDER_AN_ERROR_HAS_OCCURRED')); + } + // Send the response. static::sendResponse($state); } catch (\Exception $e) { @@ -264,6 +282,7 @@ public static function sendResponse($data = null) $response->buffer = ob_get_contents(); $response->memory = memory_get_usage(true); } + ob_clean(); // Send the JSON response. echo json_encode($response); diff --git a/administrator/language/en-GB/com_finder.ini b/administrator/language/en-GB/com_finder.ini index 1bf0cf4df979..61c5c14e33fb 100644 --- a/administrator/language/en-GB/com_finder.ini +++ b/administrator/language/en-GB/com_finder.ini @@ -159,6 +159,7 @@ COM_FINDER_INDEX_TOOLBAR_OPTIMISE="Optimise" COM_FINDER_INDEX_TOOLBAR_PURGE="Clear Index" COM_FINDER_INDEX_TOOLBAR_TITLE="Smart Search: Indexed Content" COM_FINDER_INDEX_TYPE_FILTER="Any Type of Content" +COM_FINDER_INDEXER_ERROR_PLUGIN_FAILURE="A \"finder\" plugin has had an error." COM_FINDER_INDEXER_FIELDSET_ATTRIBUTES="Result Object" COM_FINDER_INDEXER_FIELDSET_ELEMENTS="Additional Elements" COM_FINDER_INDEXER_FIELDSET_INSTRUCTIONS="Instructions" ```