Problem/Motivation
I was working on #3195568: [PP-1] Support recursive discovery for migration plugins and noticed we're using a custom Drupal\Component\FileSystem\RegexDirectoryIterator to iterate over the directory files and apply the regex filter.
It seems the same result can be achieved by using native iterators like this:
new \RegexIterator(new \FilesystemIterator($path), 'pattern');
Actually, that's not true, because the \FilesystemIterator() will iterate over SplFileInfo objects, which returns full path name in toString() method. It makes it harder to set a regular expression for the file name. For example, '/^\d/' pattern won't match 1.yml file.
I think what we can do here - change the base class of RegexDirectoryIterator to simplify the class. Instead of \FilterIterator, we can use \RegexIterator, which already accepts a pattern.
Proposed resolution
Change the base class of RegexDirectoryIterator;
API changes
Nope.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3195700-10.patch | 1.54 KB | ranjith_kumar_k_u |
Issue fork drupal-3195700
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
matroskeenComment #4
matroskeenComment #5
matroskeenComment #6
matroskeenComment #10
ranjith_kumar_k_u commentedRerolled #2
Comment #12
shubham chandra commentedRe-rolled Patch against #10 in Drupal 10.1.x
Comment #13
bnjmnm#12 was an unnecessary reroll that will not receive credit - it's just #10. As I've mentioned to you several times @Shubham Chandra - you can check if a patch truly needs a reroll by clicking "add test/retest" on the most recent patch and applying it to the most recent Drupal version. Drupal getting a new version doesn't necessarily mean a reroll is needed.
Comment #14
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
Seems like a valid addition and don't think it will need any kind of change record.
Comment #16
catchNice clean-up. Committed/pushed to 10.1.x, thanks!