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.
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 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 commentedhttp://drupal.org/node/1876514