class JsCollectionOptimizer in Flysystem 8
Same name and namespace in other branches
- 3.x src/Asset/JsCollectionOptimizer.php \Drupal\flysystem\Asset\JsCollectionOptimizer
- 2.0.x src/Asset/JsCollectionOptimizer.php \Drupal\flysystem\Asset\JsCollectionOptimizer
- 3.0.x src/Asset/JsCollectionOptimizer.php \Drupal\flysystem\Asset\JsCollectionOptimizer
Optimizes JavaScript assets.
Hierarchy
- class \Drupal\Core\Asset\JsCollectionOptimizer implements AssetCollectionOptimizerInterface
- class \Drupal\flysystem\Asset\JsCollectionOptimizer uses SchemeExtensionTrait
Expanded class hierarchy of JsCollectionOptimizer
2 files declare their use of JsCollectionOptimizer
- FlysystemServiceProviderTest.php in tests/
src/ Unit/ FlysystemServiceProviderTest.php - JsCollectionOptimizerTest.php in tests/
src/ Unit/ Asset/ JsCollectionOptimizerTest.php
File
- src/
Asset/ JsCollectionOptimizer.php, line 14
Namespace
Drupal\flysystem\AssetView source
class JsCollectionOptimizer extends DrupalJsCollectionOptimizer {
use SchemeExtensionTrait;
/**
* {@inheritdoc}
*/
public function deleteAll() {
$this->state
->delete('system.js_cache_files');
$delete_stale = function ($uri) {
// Default stale file threshold is 30 days.
if (REQUEST_TIME - filemtime($uri) > \Drupal::config('system.performance')
->get('stale_file_threshold')) {
file_unmanaged_delete($uri);
}
};
file_scan_directory($this
->getSchemeForExtension('js') . '://js', '/.*/', [
'callback' => $delete_stale,
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JsCollectionOptimizer:: |
protected | property | An asset dumper. | |
JsCollectionOptimizer:: |
protected | property | The file system service. | |
JsCollectionOptimizer:: |
protected | property | A JS asset grouper. | |
JsCollectionOptimizer:: |
protected | property | A JS asset optimizer. | |
JsCollectionOptimizer:: |
protected | property | The state key/value store. | |
JsCollectionOptimizer:: |
public | function |
Deletes all optimized asset collections assets. Overrides JsCollectionOptimizer:: |
|
JsCollectionOptimizer:: |
protected | function | Generate a hash for a given group of JavaScript assets. | |
JsCollectionOptimizer:: |
public | function |
Returns all optimized asset collections assets. Overrides AssetCollectionOptimizerInterface:: |
|
JsCollectionOptimizer:: |
public | function |
The cache file name is retrieved on a page load via a lookup variable that
contains an associative array. The array key is the hash of the names in
$files while the value is the cache file name. The cache file is generated
in two cases. First, if… Overrides AssetCollectionOptimizerInterface:: |
|
JsCollectionOptimizer:: |
public | function | Constructs a JsCollectionOptimizer. | |
SchemeExtensionTrait:: |
public | function | Returns the scheme that should serve an extension. |