function search_files_attachments_update_index in Search Files 6.2
Same name and namespace in other branches
- 7.2 search_files_attachments.module \search_files_attachments_update_index()
Implementation of hook_update_index().
1 string reference to 'search_files_attachments_update_index'
- search_files_attachments_menu in ./
search_files_attachments.module - Implementation of hook_menu().
File
- ./
search_files_attachments.module, line 223 - Used to index files in attachments
Code
function search_files_attachments_update_index() {
variable_set('search_files_attachments_last_index', time());
$limit = (int) variable_get('search_cron_limit', 100);
/* select known files related to search_files_att and marked for reindexing UNION
* or any new files not yet indexed
*/
$result = db_query_range("\n SELECT f.fid, f.filepath, d.reindex\n FROM {node} n, {upload} u, {files} f\n LEFT JOIN {search_dataset} d\n ON d.type = 'search_files_att' AND d.sid = f.fid\n WHERE (d.sid IS NULL OR d.reindex <> 0) AND n.vid = u.vid AND u.fid = f.fid\n ORDER BY d.reindex ASC, f.fid ASC", 0, $limit);
$found = $count = 0;
while ($file = db_fetch_object($result)) {
$found++;
if (search_files_attachments_index_file($file)) {
$count++;
}
}
// if we were called manually from dashboard, return to where we come from
if (preg_match('/search_files\\/(attachments|directories)$/', $_SERVER['HTTP_REFERER'])) {
search_files_update_totals('search_files_att');
drupal_goto($_SERVER['HTTP_REFERER']);
}
}