function data_search_wipe in Data 6
Same name and namespace in other branches
- 8 data_search/data_search.module \data_search_wipe()
- 7 data_search/data_search.module \data_search_wipe()
Wipe all orphaned entries for given Data table. Use instead of search_wipe() if all items that have been deleted from table $table should be wiped. In this case, data_search_wipe() is faster than search_wipe().
Note: Like search_wipe(), this function does not reset the word counts in search_total.
Parameters
$table: DataTable object.
1 call to data_search_wipe()
- data_search_cron in data_search/
data_search.module - Implementation of hook_cron().
File
- data_search/
data_search.module, line 144
Code
function data_search_wipe($table) {
$schema = $table
->get('table_schema');
$name = db_escape_table($table
->get('name'));
$field = current($schema['primary key']);
db_query("DELETE s FROM {search_dataset} s LEFT JOIN {{$name}} t ON s.sid = t.{$field} WHERE s.type = '%s' AND t.{$field} IS NULL", $table
->get('name'));
db_query("DELETE s FROM {search_index} s LEFT JOIN {{$name}} t ON s.sid = t.{$field} WHERE s.type = '%s' AND t.{$field} IS NULL", $table
->get('name'));
}