From a4f033e21735eb72df3909bd671dc8549a63c963 Mon Sep 17 00:00:00 2001 From: webchick Date: Fri, 22 Nov 2013 21:40:50 -0800 Subject: [PATCH] =?UTF-8?q?Revert=20"Rollback=20of=20Issue=20#2138239=20by?= =?UTF-8?q?=20damiankloip,=20tim.plunkett,=20amateescu:=20Use=20GlobIterat?= =?UTF-8?q?or=20instead=20of=20glob.=20=E2=80=94=20breaks=20testbot."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un-committing the un-commit of the previously committed commit. :P This reverts commit 40e903f89794e1cf99af881c8292ad1937c77379. --- core/lib/Drupal/Core/Config/FileStorage.php | 13 ++++++++----- core/lib/Drupal/Core/Config/InstallStorage.php | 7 +++---- .../lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php | 6 +++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/lib/Drupal/Core/Config/FileStorage.php b/core/lib/Drupal/Core/Config/FileStorage.php index bf178c56194..52c9aa520db 100644 --- a/core/lib/Drupal/Core/Config/FileStorage.php +++ b/core/lib/Drupal/Core/Config/FileStorage.php @@ -204,11 +204,14 @@ class FileStorage implements StorageInterface { throw new StorageException($this->directory . '/ not found.'); } $extension = '.' . static::getFileExtension(); - $files = glob($this->directory . '/' . $prefix . '*' . $extension); - $clean_name = function ($value) use ($extension) { - return basename($value, $extension); - }; - return array_map($clean_name, $files); + $files = new \GlobIterator(DRUPAL_ROOT . '/' . $this->directory . '/' . $prefix . '*' . $extension); + + $names = array(); + foreach ($files as $file) { + $names[] = $file->getBasename($extension); + } + + return $names; } /** diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php index e8442ea7a77..16bcc1c3523 100644 --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -134,10 +134,9 @@ class InstallStorage extends FileStorage { foreach ($list as $name) { $directory = $this->getComponentFolder($type, $name); if (file_exists($directory)) { - $files = glob($directory . '/*' . $extension); - foreach ($files as $filename) { - $name = basename($filename, $extension); - $folders[$name] = $directory; + $files = new \GlobIterator(DRUPAL_ROOT . '/' . $directory . '/*' . $extension); + foreach ($files as $file) { + $folders[$file->getBasename($extension)] = $directory; } } } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index bc0dc61ac5b..3eefd376b7c 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -320,9 +320,9 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface { if (empty($langcodes)) { $langcodes = array(); // Collect languages included with CKEditor based on file listing. - $ckeditor_languages = glob(DRUPAL_ROOT . '/core/assets/vendor/ckeditor/lang/*.js'); - foreach ($ckeditor_languages as $language_filename) { - $langcode = basename($language_filename, '.js'); + $ckeditor_languages = new \GlobIterator(DRUPAL_ROOT . '/core/assets/vendor/ckeditor/lang/*.js'); + foreach ($ckeditor_languages as $language_file) { + $langcode = $language_file->getBasename('.js'); $langcodes[$langcode] = $langcode; } cache('ckeditor.languages')->set('langcodes', $langcodes);