function drush_epub_flush in Epub 7
Same name and namespace in other branches
- 8 drush/epub.drush.inc \drush_epub_flush()
File
- ./
epub.drush.inc, line 33
Code
function drush_epub_flush($fid1 = NULL, $fid2 = NULL) {
$query = db_select('file_managed', 'fid')
->fields('fid', array(
'fid',
));
if (is_numeric($fid1)) {
$query
->condition('fid', $fid1, '>=');
if (is_numeric($fid2)) {
if ($fid2 > $fid1) {
$query
->condition('fid', $fid2, '<=');
}
else {
drush_set_error('Make sure fid1 < fid2.');
return False;
}
}
}
$enabled_types = file_type_get_enabled_types();
foreach ($query
->execute()
->fetchCol() as $fid) {
$file = file_load($fid);
if (epub_reset_mimetype($file)) {
drush_log(dt('File @fid: mimetype was reset.', array(
'@fid' => $file->fid,
)), 'ok');
}
/*
if (epub_file_update($file)) {
drush_log(dt('File @fid was unzipped.', array('@fid' => $file->fid)), 'ok');
}
else {
drush_log(dt('File @fid can\'t be unzipped.', array('@fid' => $file->fid)), 'warning');
}
*/
}
}