public function MinifyJs::loadAllFiles in Minify JS 8.2
Load all files.
Load all of the minifyjs_file records from cache or directly from the database.
Return value
array The list of files.
2 calls to MinifyJs::loadAllFiles()
- MinifyJs::minifyFile in src/
MinifyJs.php - Minify File.
- MinifyJs::scan in src/
MinifyJs.php - Scan for files.
File
- src/
MinifyJs.php, line 198
Class
- MinifyJs
- Minify JS Service.
Namespace
Drupal\minifyjsCode
public function loadAllFiles() {
// Load files from cache.
if ($cache = \Drupal::cache()
->get(MINIFYJS_CACHE_CID)) {
return $cache->data;
}
// Re-build cache.
$result = \Drupal::database()
->select('minifyjs_file', 'f')
->fields('f')
->orderBy('uri')
->execute();
$exclusions = \Drupal::config('minifyjs.config')
->get('exclusion_list');
$files = [];
while ($file = $result
->fetchObject()) {
// Ignore the exclusions.
if (!$this->pathMatcher
->matchPath($file->uri, $exclusions)) {
$files[$file->fid] = $file;
}
}
// Cache for 1 day.
\Drupal::cache()
->set(MINIFYJS_CACHE_CID, $files, strtotime('+1 day', \Drupal::time()
->getRequestTime()));
return $files;
}