Project

General

Profile

Bug #16753 » bug_4592.diff

Administrator Admin, 2007-01-05 20:32

View differences:

typo3/sysext/indexed_search/class.crawler.php (Arbeitskopie)
$this->pObj->addQueueEntry_callBack($cfgRec['set_id'],$nparams,$this->callBack,$cfgRec['pid']);
}
/**
* Deletes all data stored by indexed search for a given page
*
* @param integer Uid of the page to delete all pHash
* @return void
*/
function deleteFromIndex($id) {
// Lookup old phash rows:
$oldPhashRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('phash','index_section', 'page_id='.intval($id));
$pHashesToDelete = array();
foreach ($oldPhashRows as $pHashRow) {
$pHashesToDelete[] = $pHashRow['phash'];
}
$where_clause = 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')';
$tables = explode(',', 'index_debug,index_fulltext,index_grlist,index_phash,index_rel,index_section');
foreach ($tables as $table) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where_clause);
}
}
/*************************
*
* Hook functions for TCEmain (indexing of records)
......
* @param string Status "new" or "update"
* @param string Table name
* @param string Record ID. If new record its a string pointing to index inside t3lib_tcemain::substNEWwithIDs
* @param mixed Target value (ignored)
* @param object Reference to tcemain calling object
* @return void
*/
function processCmdmap_preProcess($status, $table, $id, $value, $TCEMAIN_this) {
// Clean up the index
if ($status=='delete' && $table == 'pages') {
$this->deleteFromIndex($id);
}
}
/**
* TCEmain hook function for on-the-fly indexing of database records
*
* @param string Status "new" or "update"
* @param string Table name
* @param string Record ID. If new record its a string pointing to index inside t3lib_tcemain::substNEWwithIDs
* @param array Field array of updated fields in the operation
* @param object Reference to tcemain calling object
* @return void
......
// Translate new ids.
if ($status=='new') {
$id = $pObj->substNEWwithIDs[$id];
} elseif ($table=='pages' && $status=='update' && (array_key_exists('hidden',$fieldArray) && $fieldArray['hidden']==1) || (array_key_exists('no_search',$fieldArray) && $fieldArray['no_search']==1)) {
// If the page should be hidden or not indexed after update, delete index for this page
$this->deleteFromIndex($id);
}
// Get full record and if exists, search for indexing configurations:
typo3/sysext/indexed_search/ext_localconf.php (Arbeitskopie)
$TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks']['tx_indexedsearch_crawl'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler';
// Register with TCEmain:
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_indexedsearch'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler';
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_indexedsearch'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler';
// Configure default document parsers:
(2-2/2)