[BUGFIX] IndexSearch still uses require_once 98/29898/7
authorMarkus Klein <klein.t3@mfc-linz.at>
Tue, 6 May 2014 13:44:02 +0000 (15:44 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 6 May 2014 21:27:51 +0000 (23:27 +0200)
Remove the old magic as classes are loaded properly already.

Resolves: #58567
Related: #47852
Releases: 6.2
Change-Id: Iec20bf0dbd6955950225936911eba604faf720d6
Reviewed-on: https://review.typo3.org/29898
Reviewed-by: Oliver Klee
Reviewed-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/indexed_search/Classes/Example/CrawlerHook.php
typo3/sysext/indexed_search/Classes/Hook/CrawlerFilesHook.php
typo3/sysext/indexed_search/Classes/Hook/CrawlerHook.php

index 6135096..db6cee9 100644 (file)
@@ -73,8 +73,6 @@ class CrawlerHook {
                switch ((int)$session_data['step']) {
                        case 1:
                                // Indexing Example: Content accessed with GET parameters added to URL:
-                               // Load indexer if not yet [DON'T CHANGE]:
-                               $pObj->loadIndexerClass();
                                // Get rootline from the Indexing Record (needed because the indexer relates all search results to a position in the page tree!) [DON'T CHANGE]:
                                $rl = $pObj->getUidRootLineForClosestTemplate($cfgRec['pid']);
                                // Set up language uid, if any:
@@ -107,8 +105,6 @@ class CrawlerHook {
                                break;
                        case 2:
                                // Indexing Example: Content accessed directly in file system:
-                               // Load indexer if not yet [DON'T CHANGE]:
-                               $pObj->loadIndexerClass();
                                // Get rootline from the Indexing Record (needed because the indexer relates all search results to a position in the page tree!) [DON'T CHANGE]:
                                $rl = $pObj->getUidRootLineForClosestTemplate($cfgRec['pid']);
                                // Set up language uid, if any:
@@ -124,8 +120,6 @@ class CrawlerHook {
                                break;
                        case 3:
                                // Indexing Example: Content accessed on External URLs:
-                               // Load indexer if not yet.
-                               $pObj->loadIndexerClass();
                                // Index external URL:
                                $indexerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Indexer');
                                $indexerObj->backend_initIndexer($cfgRec['pid'], 0, $sys_language_uid, '', $rl);
index ac7a7a1..871f606 100644 (file)
@@ -31,7 +31,7 @@ namespace TYPO3\CMS\IndexedSearch\Hook;
  * Crawler hook for indexed search. Works with the "crawler" extension
  * This hook is specifically used to index external files found on pages through the crawler extension.
  *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  * @see \TYPO3\CMS\IndexedSearch\Indexer::extractLinks()
  */
 class CrawlerFilesHook {
@@ -39,41 +39,28 @@ class CrawlerFilesHook {
        /**
         * Call back function for execution of a log element
         *
-        * @param       array           Params from log element.
-        * @param       object          Parent object (tx_crawler lib)
-        * @return      array           Result array
+        * @param array $params Params from log element.
+        * @param object $pObj Parent object (tx_crawler lib)
+        * @return null|array Result array
         * @todo Define visibility
         */
        public function crawler_execute($params, &$pObj) {
-               // Load indexer if not yet.
-               $this->loadIndexerClass();
-               if (is_array($params['conf'])) {
-                       // Initialize the indexer class:
-                       $indexerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Indexer');
-                       $indexerObj->conf = $params['conf'];
-                       $indexerObj->init();
-                       // Index document:
-                       if ($params['alturl']) {
-                               $fI = pathinfo($params['document']);
-                               $ext = strtolower($fI['extension']);
-                               $indexerObj->indexRegularDocument($params['alturl'], TRUE, $params['document'], $ext);
-                       } else {
-                               $indexerObj->indexRegularDocument($params['document'], TRUE);
-                       }
-                       // Return OK:
-                       return array('content' => array());
+               if (!is_array($params['conf'])) {
+                       return;
                }
+               // Initialize the indexer class:
+               $indexerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Indexer');
+               $indexerObj->conf = $params['conf'];
+               $indexerObj->init();
+               // Index document:
+               if ($params['alturl']) {
+                       $fI = pathinfo($params['document']);
+                       $ext = strtolower($fI['extension']);
+                       $indexerObj->indexRegularDocument($params['alturl'], TRUE, $params['document'], $ext);
+               } else {
+                       $indexerObj->indexRegularDocument($params['document'], TRUE);
+               }
+               // Return OK:
+               return array('content' => array());
        }
-
-       /**
-        * Include indexer class.
-        *
-        * @return      void
-        * @todo Define visibility
-        */
-       public function loadIndexerClass() {
-               global $TYPO3_CONF_VARS;
-               require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('indexed_search') . 'class.indexer.php';
-       }
-
 }
index d41b0ac..b30b7fa 100644 (file)
@@ -291,8 +291,6 @@ class CrawlerHook {
                                // If file, index it!
                                // Get root line (need to provide this when indexing external files)
                                $rl = $this->getUidRootLineForClosestTemplate($cfgRec['pid']);
-                               // Load indexer if not yet.
-                               $this->loadIndexerClass();
                                // (Re)-Indexing file on page.
                                $indexerObj = GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Indexer');
                                $indexerObj->backend_initIndexer($cfgRec['pid'], 0, 0, '', $rl);
@@ -495,8 +493,6 @@ class CrawlerHook {
         * @todo Define visibility
         */
        public function indexExtUrl($url, $pageId, $rl, $cfgUid, $setId) {
-               // Load indexer if not yet.
-               $this->loadIndexerClass();
                // Index external URL:
                $indexerObj = GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Indexer');
                $indexerObj->backend_initIndexer($pageId, 0, 0, '', $rl);
@@ -544,8 +540,6 @@ class CrawlerHook {
         * @todo Define visibility
         */
        public function indexSingleRecord($r, $cfgRec, $rl = NULL) {
-               // Load indexer if not yet.
-               $this->loadIndexerClass();
                // Init:
                $rl = is_array($rl) ? $rl : $this->getUidRootLineForClosestTemplate($cfgRec['pid']);
                $fieldList = GeneralUtility::trimExplode(',', $cfgRec['fieldlist'], TRUE);
@@ -574,10 +568,10 @@ class CrawlerHook {
         *
         * @return      void
         * @todo Define visibility
+        * @deprecated since 6.2 will be removed two version later. Rely on autoloading of the indexer class.
         */
        public function loadIndexerClass() {
-               global $TYPO3_CONF_VARS;
-               require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('indexed_search') . 'class.indexer.php';
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
        }
 
        /**