private static function CleanerTestFilesClearing::changeFilesModificationTime in Cleaner 7
Change file modification time.
1 call to CleanerTestFilesClearing::changeFilesModificationTime()
- CleanerTestFilesClearing::testFilesClearing in tests/
cleaner_files.test - Test clearing CSS/JS files.
File
- tests/
cleaner_files.test, line 94 - Test Clearing CSS/JS files.
Class
- CleanerTestFilesClearing
- Class CleanerTestFilesClearing.
Code
private static function changeFilesModificationTime() {
// Set time to -10 hours from now.
$time = time() - 36000;
// Make changes for CSS and JS files.
foreach (array(
'css',
'js',
) as $type) {
// Get files directory real path.
$dir = drupal_realpath('public://' . $type);
foreach (scandir($dir) as $file) {
// Check is file name contain 'css' or 'js'.
if (strpos($file, $type) !== FALSE) {
// Change file modification time.
touch($dir . '/' . $file, $time);
}
}
// Clear file status cache.
clearstatcache();
}
}