You are here

public function FileStorage::listAll in Drupal 9

Same name in this branch
  1. 9 core/lib/Drupal/Core/Config/FileStorage.php \Drupal\Core\Config\FileStorage::listAll()
  2. 9 core/lib/Drupal/Component/PhpStorage/FileStorage.php \Drupal\Component\PhpStorage\FileStorage::listAll()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/PhpStorage/FileStorage.php \Drupal\Component\PhpStorage\FileStorage::listAll()

Lists all the files in the storage.

Return value

array Array of filenames.

Overrides PhpStorageInterface::listAll

1 call to FileStorage::listAll()
MTimeProtectedFastFileStorage::garbageCollection in core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
Performs garbage collection on the storage.

File

core/lib/Drupal/Component/PhpStorage/FileStorage.php, line 198

Class

FileStorage
Stores the code as regular PHP files.

Namespace

Drupal\Component\PhpStorage

Code

public function listAll() {
  $names = [];
  if (file_exists($this->directory)) {
    foreach (new \DirectoryIterator($this->directory) as $fileinfo) {
      if (!$fileinfo
        ->isDot()) {
        $name = $fileinfo
          ->getFilename();
        if ($name != '.htaccess') {
          $names[] = $name;
        }
      }
    }
  }
  return $names;
}