Loading core/lib/Drupal/Core/Config/FileStorage.php +4 −2 Original line number Diff line number Diff line Loading @@ -207,8 +207,9 @@ public function listAll($prefix = '') { $files = scandir($dir); $names = array(); $pattern = '/^' . preg_quote($prefix, '/') . '.*' . preg_quote($extension, '/') . '$/'; foreach ($files as $file) { if ($file[0] !== '.' && fnmatch($prefix . '*' . $extension, $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $names[] = basename($file, $extension); } } Loading Loading @@ -290,6 +291,7 @@ public function getAllCollectionNames() { */ protected function getAllCollectionNamesHelper($directory) { $collections = array(); $pattern = '/\.' . preg_quote($this->getFileExtension(), '/') . '$/'; foreach (new \DirectoryIterator($directory) as $fileinfo) { if ($fileinfo->isDir() && !$fileinfo->isDot()) { $collection = $fileinfo->getFilename(); Loading @@ -309,7 +311,7 @@ protected function getAllCollectionNamesHelper($directory) { // collection. // @see \Drupal\Core\Config\FileStorage::listAll() foreach (scandir($directory . '/' . $collection) as $file) { if ($file[0] !== '.' && fnmatch('*.' . $this->getFileExtension(), $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $collections[] = $collection; break; } Loading core/lib/Drupal/Core/Config/InstallStorage.php +4 −2 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ protected function getAllFolders() { */ public function getComponentNames(array $list) { $extension = '.' . $this->getFileExtension(); $pattern = '/' . preg_quote($extension, '/') . '$/'; $folders = array(); foreach ($list as $extension_object) { // We don't have to use ExtensionDiscovery here because our list of Loading @@ -203,7 +204,7 @@ public function getComponentNames(array $list) { $files = scandir($directory); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $folders[basename($file, $extension)] = $directory; } } Loading @@ -220,6 +221,7 @@ public function getComponentNames(array $list) { */ public function getCoreNames() { $extension = '.' . $this->getFileExtension(); $pattern = '/' . preg_quote($extension, '/') . '$/'; $folders = array(); $directory = $this->getCoreFolder(); if (is_dir($directory)) { Loading @@ -230,7 +232,7 @@ public function getCoreNames() { $files = scandir($directory); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $folders[basename($file, $extension)] = $directory; } } Loading core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +1 −1 Original line number Diff line number Diff line Loading @@ -335,7 +335,7 @@ public function getLangcodes() { // Collect languages included with CKEditor based on file listing. $files = scandir('core/assets/vendor/ckeditor/lang'); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*.js', $file)) { if ($file[0] !== '.' && preg_match('/\.js$/', $file)) { $langcode = basename($file, '.js'); $langcodes[$langcode] = $langcode; } Loading core/modules/config/src/Tests/Storage/FileStorageTest.php +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ public function testlistAll() { $config_files = $this->storage->listAll(); $this->assertIdentical($config_files, $expected_files, 'Relative path, two config files found.'); // @todo https://www.drupal.org/node/2666954 FileStorage::listAll() is // case-sensitive. However, \Drupal\Core\Config\DatabaseStorage::listAll() // is case-insensitive. $this->assertIdentical(['system.performance'], $this->storage->listAll('system'), 'The FileStorage::listAll() with prefix works.'); $this->assertIdentical([], $this->storage->listAll('System'), 'The FileStorage::listAll() is case sensitive.'); // Initialize FileStorage with absolute file path. $absolute_path = realpath($this->directory); $storage_absolute_path = new FileStorage($absolute_path); Loading core/modules/migrate/src/MigrateTemplateStorage.php +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public function getAllTemplates() { if (file_exists($full_directory)) { $files = scandir($full_directory); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*.yml', $file)) { if ($file[0] !== '.' && preg_match('/\.yml$/', $file)) { $templates[basename($file, '.yml')] = Yaml::decode(file_get_contents("$full_directory/$file")); } } Loading Loading
core/lib/Drupal/Core/Config/FileStorage.php +4 −2 Original line number Diff line number Diff line Loading @@ -207,8 +207,9 @@ public function listAll($prefix = '') { $files = scandir($dir); $names = array(); $pattern = '/^' . preg_quote($prefix, '/') . '.*' . preg_quote($extension, '/') . '$/'; foreach ($files as $file) { if ($file[0] !== '.' && fnmatch($prefix . '*' . $extension, $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $names[] = basename($file, $extension); } } Loading Loading @@ -290,6 +291,7 @@ public function getAllCollectionNames() { */ protected function getAllCollectionNamesHelper($directory) { $collections = array(); $pattern = '/\.' . preg_quote($this->getFileExtension(), '/') . '$/'; foreach (new \DirectoryIterator($directory) as $fileinfo) { if ($fileinfo->isDir() && !$fileinfo->isDot()) { $collection = $fileinfo->getFilename(); Loading @@ -309,7 +311,7 @@ protected function getAllCollectionNamesHelper($directory) { // collection. // @see \Drupal\Core\Config\FileStorage::listAll() foreach (scandir($directory . '/' . $collection) as $file) { if ($file[0] !== '.' && fnmatch('*.' . $this->getFileExtension(), $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $collections[] = $collection; break; } Loading
core/lib/Drupal/Core/Config/InstallStorage.php +4 −2 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ protected function getAllFolders() { */ public function getComponentNames(array $list) { $extension = '.' . $this->getFileExtension(); $pattern = '/' . preg_quote($extension, '/') . '$/'; $folders = array(); foreach ($list as $extension_object) { // We don't have to use ExtensionDiscovery here because our list of Loading @@ -203,7 +204,7 @@ public function getComponentNames(array $list) { $files = scandir($directory); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $folders[basename($file, $extension)] = $directory; } } Loading @@ -220,6 +221,7 @@ public function getComponentNames(array $list) { */ public function getCoreNames() { $extension = '.' . $this->getFileExtension(); $pattern = '/' . preg_quote($extension, '/') . '$/'; $folders = array(); $directory = $this->getCoreFolder(); if (is_dir($directory)) { Loading @@ -230,7 +232,7 @@ public function getCoreNames() { $files = scandir($directory); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*' . $extension, $file)) { if ($file[0] !== '.' && preg_match($pattern, $file)) { $folders[basename($file, $extension)] = $directory; } } Loading
core/modules/ckeditor/src/Plugin/Editor/CKEditor.php +1 −1 Original line number Diff line number Diff line Loading @@ -335,7 +335,7 @@ public function getLangcodes() { // Collect languages included with CKEditor based on file listing. $files = scandir('core/assets/vendor/ckeditor/lang'); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*.js', $file)) { if ($file[0] !== '.' && preg_match('/\.js$/', $file)) { $langcode = basename($file, '.js'); $langcodes[$langcode] = $langcode; } Loading
core/modules/config/src/Tests/Storage/FileStorageTest.php +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ public function testlistAll() { $config_files = $this->storage->listAll(); $this->assertIdentical($config_files, $expected_files, 'Relative path, two config files found.'); // @todo https://www.drupal.org/node/2666954 FileStorage::listAll() is // case-sensitive. However, \Drupal\Core\Config\DatabaseStorage::listAll() // is case-insensitive. $this->assertIdentical(['system.performance'], $this->storage->listAll('system'), 'The FileStorage::listAll() with prefix works.'); $this->assertIdentical([], $this->storage->listAll('System'), 'The FileStorage::listAll() is case sensitive.'); // Initialize FileStorage with absolute file path. $absolute_path = realpath($this->directory); $storage_absolute_path = new FileStorage($absolute_path); Loading
core/modules/migrate/src/MigrateTemplateStorage.php +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public function getAllTemplates() { if (file_exists($full_directory)) { $files = scandir($full_directory); foreach ($files as $file) { if ($file[0] !== '.' && fnmatch('*.yml', $file)) { if ($file[0] !== '.' && preg_match('/\.yml$/', $file)) { $templates[basename($file, '.yml')] = Yaml::decode(file_get_contents("$full_directory/$file")); } } Loading