Remove empty temporary files left behind by AdvAgg.
Fichier
-
./
advagg.install, line 439
Code
function advagg_update_7204(&$sandbox) {
// Make sure the advagg_get_root_files_dir() function is available.
drupal_load('module', 'advagg');
// Get the advagg paths.
$advagg_path = advagg_get_root_files_dir();
// Get the top level path.
$top_level = substr($advagg_path[0][0], 0, strpos($advagg_path[0][0], 'advagg_css'));
// Start timer.
timer_start(__FUNCTION__);
// Remove empty temp files from public://.
$files = file_scan_directory($top_level, '/file.*/', array(
'recurse' => FALSE,
'callback' => 'advagg_install_delete_empty_file_if_stale',
));
// Stop timer.
$time = timer_stop(__FUNCTION__);
$time = round($time['time'] / 1000, 4);
// Output info.
if (count($files) > 0) {
return t('%count temporary files where removed in %time seconds', array(
'%count' => count($files),
'%time' => $time,
));
}
else {
return t('Nothing needed to be done.');
}
}