Project

General

Profile

Bug #20393 ยป 0011033.patch

Administrator Admin, 2009-05-06 15:42

View differences:

typo3/sysext/indexed_search/hooks/class.tx_indexedsearch_tslib_fe_hook.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Hooks for tslib_fe (TSFE).
*
* $Id$
*
* @author Oliver Hader <oliver@typo3.org>
* @package TYPO3
* @subpackage tx_indexedsearch
*/
class tx_indexedsearch_tslib_fe_hook {
/**
* Frontend hook: If the page is not being re-generated this is our chance to force it to be (because re-generation of the page is required in order to have the indexer called!)
*
* @param array Parameters from frontend
* @param object TSFE object (reference under PHP5)
* @return void
*/
public function headerNoCache(array &$params, $ref) {
// Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction:
if (t3lib_extMgm::isLoaded('crawler')
&& $params['pObj']->applicationData['tx_crawler']['running']
&& in_array('tx_indexedsearch_reindex', $params['pObj']->applicationData['tx_crawler']['parameters']['procInstructions'])) {
// Setting simple log entry:
$params['pObj']->applicationData['tx_crawler']['log'][] = 'RE_CACHE (indexed), old status: '.$params['disableAcquireCacheData'];
// Disables a look-up for cached page data - thus resulting in re-generation of the page even if cached.
$params['disableAcquireCacheData'] = TRUE;
}
}
}
?>
typo3/sysext/indexed_search/class.indexer.php (Arbeitskopie)
* @param array Parameters from frontend
* @param object TSFE object (reference under PHP5)
* @return void
* @deprecated since TYPO3 4.3 - the method was extracted to hooks/class.tx_indexedsearch_tslib_fe_hook.php
*/
function fe_headerNoCache(&$params, $ref) {
// Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction:
if (t3lib_extMgm::isLoaded('crawler')
&& $params['pObj']->applicationData['tx_crawler']['running']
&& in_array('tx_indexedsearch_reindex', $params['pObj']->applicationData['tx_crawler']['parameters']['procInstructions'])) {
// Setting simple log entry:
$params['pObj']->applicationData['tx_crawler']['log'][] = 'RE_CACHE (indexed), old status: '.$params['disableAcquireCacheData'];
// Disables a look-up for cached page data - thus resulting in re-generation of the page even if cached.
$params['disableAcquireCacheData'] = TRUE;
}
require_once t3lib_extMgm::extPath('indexed_search') . 'hooks/class.tx_indexedsearch_tslib_fe_hook.php';
t3lib_div::makeInstance('tx_indexedsearch_tslib_fe_hook')->headerNoCache($params, $ref);
}
}
typo3/sysext/indexed_search/ext_localconf.php (Arbeitskopie)
// Attach to hooks:
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = 'EXT:indexed_search/class.indexer.php:tx_indexedsearch_indexer';
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = 'EXT:indexed_search/class.indexer.php:&tx_indexedsearch_indexer->fe_headerNoCache';
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = 'EXT:indexed_search/hooks/class.tx_indexedsearch_tslib_fe_hook.php:&tx_indexedsearch_tslib_fe_hook->headerNoCache';
// Register with "crawler" extension:
$TYPO3_CONF_VARS['EXTCONF']['crawler']['procInstructions']['tx_indexedsearch_reindex'] = 'Re-indexing';
    (1-1/1)