[BUGFIX] Remove crawler initialization in indexed search 12/46412/2
authorBenni Mack <benni@typo3.org>
Thu, 28 Jan 2016 18:33:09 +0000 (19:33 +0100)
committerBenni Mack <benni@typo3.org>
Sat, 30 Jan 2016 19:47:00 +0000 (20:47 +0100)
There is a leftover stub run from the global scope to ensure
that the hook uses the proper backend charset. This code
was never executed in the current version of crawler, but
still may be viable in some situations. Therefore it is added
to the constructor method of the actual Crawler Hook.

Resolves: #72998
Releases: master, 7.6
Change-Id: Ie091c2bbe7c3eafaf8ab33ac2065501d44c35bd8
Reviewed-on: https://review.typo3.org/46412
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/indexed_search/Classes/Hook/CrawlerHook.php
typo3/sysext/indexed_search/class.crawler.php [deleted file]

index 7bf4a1a..453e3d2 100644 (file)
@@ -43,6 +43,18 @@ class CrawlerHook
     public $callBack = CrawlerHook::class;
 
     /**
+     * The constructor
+     */
+    public function __construct()
+    {
+        // To make sure the backend charset is available:
+        if (!is_object($GLOBALS['LANG'])) {
+            $GLOBALS['LANG'] = GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
+            $GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']);
+        }
+    }
+
+    /**
      * Initialization of crawler hook.
      * This function is asked for each instance of the crawler and we must check if something is timed to happen and if so put entry(s) in the crawlers log to start processing.
      * In reality we select indexing configurations and evaluate if any of them needs to run.
diff --git a/typo3/sysext/indexed_search/class.crawler.php b/typo3/sysext/indexed_search/class.crawler.php
deleted file mode 100644 (file)
index f559f48..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Crawler hook for indexed search. Works with the "crawler" extension
- */
-// To make sure the backend charset is available:
-if (!is_object($GLOBALS['LANG'])) {
-    $GLOBALS['LANG'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
-    $GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']);
-}