[TASK] Cleanup EXT:indexed_search 08/28308/5
authorWouter Wolters <typo3@wouterwolters.nl>
Thu, 13 Mar 2014 22:26:44 +0000 (23:26 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 13 Mar 2014 22:34:17 +0000 (23:34 +0100)
* Move modAccess check to constructor
* Move isLoaded check to constructor
* Remove check if extbase is loaded
* Replace $TYPO3_CONF_VARS to $GLOBALS['TYPO3_CONF_VARS']

Resolves: #56831
Releases: 6.2
Change-Id: Ib824d34219bc1afb646fbaf70b572b6bd3a55a47
Reviewed-on: https://review.typo3.org/28308
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/indexed_search/Classes/Controller/ModuleController.php
typo3/sysext/indexed_search/ext_localconf.php
typo3/sysext/indexed_search/ext_tables.php
typo3/sysext/indexed_search/mod/index.php
typo3/sysext/indexed_search_mysql/ext_localconf.php

index 5affbdc..ab336f6 100644 (file)
@@ -70,6 +70,14 @@ class ModuleController {
        public $content;
 
        /**
+        * Constructor
+        */
+       public function __construct() {
+               $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('indexed_search', TRUE);
+       }
+
+       /**
         * Initialization
         *
         * @return      void
index 046c2bd..ed40bf2 100644 (file)
@@ -5,16 +5,16 @@ if (!defined('TYPO3_MODE')) {
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY);
 \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin($_EXTKEY, 'Pi2', array('Search' => 'form,search'), array('Search' => 'form,search'));
 // Attach to hooks:
-$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = 'TYPO3\\CMS\\IndexedSearch\\Indexer';
-$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\TypoScriptFrontendHook->headerNoCache';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = 'TYPO3\\CMS\\IndexedSearch\\Indexer';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\TypoScriptFrontendHook->headerNoCache';
 // Register with "crawler" extension:
-$TYPO3_CONF_VARS['EXTCONF']['crawler']['procInstructions']['tx_indexedsearch_reindex'] = 'Re-indexing';
-$TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks']['tx_indexedsearch_crawl'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\CrawlerHook';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['procInstructions']['tx_indexedsearch_reindex'] = 'Re-indexing';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['cli_hooks']['tx_indexedsearch_crawl'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\CrawlerHook';
 // Register with TCEmain:
-$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_indexedsearch'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\CrawlerHook';
-$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_indexedsearch'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\CrawlerHook';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_indexedsearch'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\CrawlerHook';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_indexedsearch'] = '&TYPO3\\CMS\\IndexedSearch\\Hook\\CrawlerHook';
 // Configure default document parsers:
-$TYPO3_CONF_VARS['EXTCONF']['indexed_search']['external_parsers'] = array(
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['external_parsers'] = array(
        'pdf' => '&TYPO3\\CMS\\IndexedSearch\\FileContentParser',
        'doc' => '&TYPO3\\CMS\\IndexedSearch\\FileContentParser',
        'pps' => '&TYPO3\\CMS\\IndexedSearch\\FileContentParser',
@@ -36,10 +36,10 @@ $TYPO3_CONF_VARS['EXTCONF']['indexed_search']['external_parsers'] = array(
        'jpeg' => '&TYPO3\\CMS\\IndexedSearch\\FileContentParser',
        'tif' => '&TYPO3\\CMS\\IndexedSearch\\FileContentParser'
 );
-$TYPO3_CONF_VARS['EXTCONF']['indexed_search']['use_tables'] = 'index_phash,index_fulltext,index_rel,index_words,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['use_tables'] = 'index_phash,index_fulltext,index_rel,index_words,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config';
 // unserializing the configuration so we can use it here:
 $_EXTCONF = unserialize($_EXTCONF);
 // Use the advanced doubleMetaphone parser instead of the internal one (usage of metaphone parsers is generally disabled by default)
 if (isset($_EXTCONF['enableMetaphoneSearch']) && (int)$_EXTCONF['enableMetaphoneSearch'] == 2) {
-       $TYPO3_CONF_VARS['EXTCONF']['indexed_search']['metaphone'] = '&TYPO3\\CMS\\IndexedSearch\\Utility\\DoubleMetaPhoneUtility';
+       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['metaphone'] = '&TYPO3\\CMS\\IndexedSearch\\Utility\\DoubleMetaPhoneUtility';
 }
index f0357b8..bdfccd6 100644 (file)
@@ -2,19 +2,35 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
+
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(array('LLL:EXT:indexed_search/locallang.xlf:mod_indexed_search', $_EXTKEY));
 $TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY] = 'layout,select_key,pages';
+
 // Registers the Extbase plugin to be listed in the Backend.
-if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('extbase')) {
-       $extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
-       \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin($_EXTKEY, 'Pi2', 'Indexed Search (experimental)');
-       $pluginSignature = strtolower($extensionName) . '_pi2';
-       $TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,pages,recursive';
-}
-if (TYPO3_MODE == 'BE') {
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('tools', 'isearch', 'after:log', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod/');
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction('web_info', 'TYPO3\\CMS\\IndexedSearch\\Controller\\IndexedPagesController', NULL, 'LLL:EXT:indexed_search/locallang.xlf:mod_indexed_search');
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction('web_info', 'TYPO3\\CMS\\IndexedSearch\\Controller\\IndexingStatisticsController', NULL, 'LLL:EXT:indexed_search/locallang.xlf:mod2_indexed_search');
+$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
+\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin($_EXTKEY, 'Pi2', 'Indexed Search (experimental)');
+$pluginSignature = strtolower($extensionName) . '_pi2';
+$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,pages,recursive';
+
+if (TYPO3_MODE === 'BE') {
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
+               'tools',
+               'isearch',
+               'after:log',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod/'
+       );
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
+               'web_info',
+               'TYPO3\\CMS\\IndexedSearch\\Controller\\IndexedPagesController',
+               NULL,
+               'LLL:EXT:indexed_search/locallang.xlf:mod_indexed_search'
+       );
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
+               'web_info',
+               'TYPO3\\CMS\\IndexedSearch\\Controller\\IndexingStatisticsController',
+               NULL,
+               'LLL:EXT:indexed_search/locallang.xlf:mod2_indexed_search'
+       );
 }
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('index_config');
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('index_config', 'EXT:indexed_search/locallang_csh_indexcfg.xlf');
index 6614032..2018c7d 100644 (file)
 
 /**
  * Module: Indexing Engine Overview
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
-$BE_USER->modAccess($MCONF, 1);
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('indexed_search', 1);
+
 $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Controller\\ModuleController');
 $SOBE->init();
 $SOBE->main();
index 5253c0a..e7a3519 100644 (file)
@@ -3,6 +3,6 @@ if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
 // Configure hook to query the fulltext index
-$TYPO3_CONF_VARS['EXTCONF']['indexed_search']['pi1_hooks']['getResultRows_SQLpointer'] = '&TYPO3\CMS\IndexedSearch\Hook\MysqlFulltextIndexHook';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['pi1_hooks']['getResultRows_SQLpointer'] = '&TYPO3\CMS\IndexedSearch\Hook\MysqlFulltextIndexHook';
 // Use all index_* tables except "index_rel" and "index_words"
-$TYPO3_CONF_VARS['EXTCONF']['indexed_search']['use_tables'] = 'index_phash,index_fulltext,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['use_tables'] = 'index_phash,index_fulltext,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config';