function search_file_attachments_get_files in Search File Attachments 7
Load the files to be indexed.
Parameters
int $last_change: The timestamp of the last indexed file, or the timestamp of the last time that files were indexed (if the last indexed file is also the one with the largest file ID).
int $last_id: The highest file ID of all files that have been previously indexed.
Return value
array The array with the file objects.
1 call to search_file_attachments_get_files()
- search_file_attachments_update_index in ./
search_file_attachments.module - Implements hook_update_index().
File
- ./
search_file_attachments.inc, line 63 - Heler functions, to hold the .module file clean and smart.
Code
function search_file_attachments_get_files($last_change = 0, $last_id = 0) {
$limit = (int) variable_get('search_cron_limit', 10);
$fids = array();
$query = db_select('file_managed', 'f');
$query
->fields('f', array(
'fid',
))
->condition('f.status', 1)
->condition(db_or()
->condition('f.fid', $last_id, '>')
->condition('f.timestamp', $last_change, '>'))
->orderBy('f.fid')
->range(0, $limit);
$results = $query
->execute();
foreach ($results as $record) {
$fids[] = $record->fid;
}
$files = !empty($fids) ? file_load_multiple($fids) : array();
return $files;
}