Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Config / FileStorage.php
index 84d23d32745abe6d6d9b6b6ef088a77a33e1c8c4..60c5fa11d65555a44da5e1817e634277c3b2d1e7 100644 (file)
@@ -46,7 +46,7 @@ class FileStorage implements StorageInterface {
     $this->collection = $collection;
 
     // Use a NULL File Cache backend by default. This will ensure only the
-    // internal statc caching of FileCache is used and thus avoids blowing up
+    // internal static caching of FileCache is used and thus avoids blowing up
     // the APCu cache.
     $this->fileCache = FileCacheFactory::get('config', ['cache_backend_class' => NULL]);
   }
@@ -279,6 +279,9 @@ class FileStorage implements StorageInterface {
    * {@inheritdoc}
    */
   public function getAllCollectionNames() {
+    if (!is_dir($this->directory)) {
+      return [];
+    }
     $collections = $this->getAllCollectionNamesHelper($this->directory);
     sort($collections);
     return $collections;
@@ -305,7 +308,8 @@ class FileStorage implements StorageInterface {
    * @param string $directory
    *   The directory to check for sub directories. This allows this
    *   function to be used recursively to discover all the collections in the
-   *   storage.
+   *   storage. It is the responsibility of the caller to ensure the directory
+   *   exists.
    *
    * @return array
    *   A list of collection names contained within the provided directory.