Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The task is to change the function to:
function file_stream_wrapper_valid_scheme($scheme) {
return $scheme && class_exists(file_stream_wrapper_get_class($scheme));
}
and then take these:
346: if ($scheme && file_stream_wrapper_valid_scheme($scheme)) {
596: if (empty($uri_scheme) || !file_stream_wrapper_valid_scheme($uri_scheme)) {
1171: if (!$destination_scheme || !file_stream_wrapper_valid_scheme($destination_scheme)) {
1598: if ((!$scheme || !file_stream_wrapper_valid_scheme($scheme)) && (substr(PHP_OS, 0, 3) == 'WIN')) {
1671: if ($scheme && file_stream_wrapper_valid_scheme($scheme)) {
1764: if ((!$scheme || !file_stream_wrapper_valid_scheme($scheme)) && (substr(PHP_OS, 0, 3) == 'WIN')) {
1800: if ($scheme && file_stream_wrapper_valid_scheme($scheme)) {
and remove the superflous testing for $scheme, ie make the first if (file_stream_wrapper_valid_scheme($scheme)) {
, the second if (!file_stream_wrapper_valid_scheme($uri_scheme)) {
Note that #1874562: Upgrade path broken and yet tests pass adds one more so if it is committed, then that needs to be done too.
Comment | File | Size | Author |
---|---|---|---|
#4 | rewrite_checking_schema-1874612-4.patch | 4.12 KB | plopesc |
#1 | rewrite_checking_schema-1874612-1.patch | 4.12 KB | plopesc |
Comments
Comment #1
plopescHello
Attaching patch that rewrites the checking process through the suggested function.
The function is also called from system module. The suferfluous testing has been removed too.
Regards
Comment #2
plopescChanging status.
Comment #4
plopescRe-rolling patch. Testing problems should be fixed now.
Comment #5
chx CreditAttribution: chx commentedThe reason for test failures were: file_valid_uri and drupal_rmdir had file_stream_wrapper_valid_scheme instead of !file_stream_wrapper_valid_scheme. The patch at this point contains no functional change just simplifies code.
Comment #6
catchVery nice. Could use a small change notice so contrib can remove similar checks.
Comment #7
chx CreditAttribution: chx commentedhttp://drupal.org/node/1876514