Dependencies: This patch requires #227232: Support PHP stream wrappers being committed first.
Also see part 2 which depends on this this patch: #517814: File API Stream Wrapper Conversion.
Synopsis
This patch begins introducing stream wrapper support into the File API. drupal_dirname() and drupal_realpath() are added to compensate for some deficiencies in PHP's native stream wrapper support. Calls to dirname() and realpath() are substituted accordingly. drupal_chmod() was also updated with wrapper support.
All three functions are backwards compatible and will work with both normal paths and streams.
Why this is needed
Follow-up patch #517814: File API Stream Wrapper Conversion integrates stream wrappers throughout core and depend on these changes being made to cover the small gaps in PHP's stream wrapper support.
To test this patch
The testing bot will not be able to test this patch until dependencies are committed. In the mean time, you can test this patch locally by applying in the following sequence: #227232: Support PHP stream wrappers, this patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | fileapi-1_wrappers-2.patch | 20.78 KB | jmstacey |
| #4 | fileapi-1_wrappers-1.patch | 20.42 KB | jmstacey |
| fileapi-1_wrappers.patch | 17.13 KB | jmstacey |
Comments
Comment #1
aaron commentedsubscribing
Comment #2
drewish commentedsubscribing
Comment #3
drewish commentedall in all it looks like a good patch. did a super quick review...
odd spacing.
This seems a little odd... I think the original is correct but we can specify that the $path can be a stream.
We should really add in a @see to chmod() I think the api.module is smart enough to link that back to PHP's docs.
can we ditch these leading new lines?
Again hate canonicalized.
Comment #4
jmstacey commentedIt's actually aligning with the '=' in the previous line. I had to change the line anyway so I thought I'd take the liberty (skimming code is a lot nicer when everything is lined up and not bunched together). Would you like me to remove it nonetheless?
I've made all of the other changes. I've also added @see realpath() and @see dirname().
file_get_mimetype() has also been moved from sister patch #2 now that it is backwards compatible.
Edit: And some type hint removals.
Comment #5
jmstacey commentedSome minor modifications because of upstream changes. Upstream being Drupal 7 Head and #227232: Support PHP stream wrappers.
Comment #6
pwolanin commentedfor easier development, consolidating all action to #517814: File API Stream Wrapper Conversion