You are here

public function AdvaggCommands::forceNewAggregates in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 src/Commands/AdvaggCommands.php \Drupal\advagg\Commands\AdvaggCommands::forceNewAggregates()

Force the creation of all new files by incrementing a global counter.

@command advagg-force-new-aggregates @usage Standard example drush advagg-force-new-aggregates @aliases advagg-fna

File

src/Commands/AdvaggCommands.php, line 138

Class

AdvaggCommands
Advagg commands for Drush 9+.

Namespace

Drupal\advagg\Commands

Code

public function forceNewAggregates() {

  // Clear out the cache.
  $this
    ->clearAllFiles();

  // Increment counter.
  $new_value = $this->advaggConfig
    ->get('global_counter') + 1;
  $this->advaggConfig
    ->set('global_counter', $new_value)
    ->save();
  $this
    ->logger()
    ->notice(dt('Global counter is now set to @new_value', [
    '@new_value' => $new_value,
  ]));
  _drupal_flush_css_js();
}