Same name and namespace in other branches
  1. 5.0.x src/Commands/AdvaggCommands.php \Drupal\advagg\Commands\AdvaggCommands::clearAllFiles() 1 commentaire
  2. 8.x-3.x src/Commands/AdvaggCommands.php \Drupal\advagg\Commands\AdvaggCommands::clearAllFiles() 1 commentaire
  3. 8.x-4.x src/Commands/AdvaggCommands.php \Drupal\advagg\Commands\AdvaggCommands::clearAllFiles() 1 commentaire

Remove all generated files.

@command advagg-clear-all-files @usage Standard example drush advagg-clear-all-files @aliases advagg-caf

1 call to AdvaggCommands::clearAllFiles()
AdvaggCommands::forceNewAggregates dans src/Commands/AdvaggCommands.php
Force the creation of all new files by incrementing a global counter.

Fichier

src/Commands/AdvaggCommands.php, line 110

Classe

AdvaggCommands
Advagg commands for Drush 9+.

Namespace

Drupal\advagg\Commands

Code

public function clearAllFiles() {
    // Clear out the cache.
    Cache::invalidateTags([
        'library_info',
    ]);
    $this->cache
        ->invalidateAll();
    $pub = $this->fileSystem
        ->realpath('public://');
    $css_count = count(glob($pub . '/css/optimized/*.css'));
    $js_count = count(glob($pub . '/js/optimized/*.js'));
    foreach ([
        'public://js/optimized',
        'public://css/optimized',
    ] as $path) {
        if (file_exists($path)) {
            $this->fileSystem
                ->deleteRecursive($path);
        }
    }
    // Report back the results.
    $this->logger()
        ->notice(dt('All AdvAgg optimized files have been deleted. %css_count CSS files and %js_count JS files have been removed.', [
        '%css_count' => $css_count,
        '%js_count' => $js_count,
    ]));
}