You are here

public function State::clearMissingFiles in Advanced CSS/JS Aggregation 8.2

Scan the filesystem for missing files and removee from database.

File

src/State/State.php, line 53

Class

State
Provides AdvAgg State interfaces with a few extra commands.

Namespace

Drupal\advagg\State

Code

public function clearMissingFiles() {
  $removed = [];
  $values = $this
    ->getAll();
  if (empty($values)) {
    return $removed;
  }
  if ($this->pathColumn) {
    $values = array_column($values, NULL, $this->pathColumn);
  }
  foreach ($values as $path => $details) {
    if (!file_exists($path)) {
      $removed[$path] = $values[$path];
      $this
        ->delete($path);
    }
  }
  return $removed;
}