Skip to content
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

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

Closed
joomlapl-bot opened this issue May 31, 2023 · 0 comments
Closed

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

joomlapl-bot opened this issue May 31, 2023 · 0 comments

Comments

@joomlapl-bot
Copy link
Collaborator

PR w związku ze zmianą oryginału joomla/joomla-cms#39965 Poniżej zmiany w oryginale:

Click to expand the 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants