Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
ed125d48
Commit
ed125d48
authored
14 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#858528
by Damien Tournoud, chx: file_uri_target() purpose is unclear.
parent
a25b6054
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/file.inc
+5
-5
5 additions, 5 deletions
includes/file.inc
includes/stream_wrappers.inc
+15
-20
15 additions, 20 deletions
includes/stream_wrappers.inc
with
20 additions
and
25 deletions
includes/file.inc
+
5
−
5
View file @
ed125d48
...
...
@@ -203,7 +203,7 @@ function file_stream_wrapper_valid_scheme($scheme) {
}
/**
* Returns the
t
ar
ge
t of a URI
(e.g. a stream)
.
* Returns the
p
art of a
n
URI
after the schema
.
*
* @param $uri
* A stream, referenced as "scheme://target".
...
...
@@ -216,10 +216,10 @@ function file_stream_wrapper_valid_scheme($scheme) {
* @see file_uri_scheme()
*/
function
file_uri_target
(
$uri
)
{
if
(
$scheme
=
file_uri_scheme
(
$uri
))
{
return
file_stream_wrapper_get_instance_by_scheme
(
$scheme
)
->
getTarget
(
$uri
);
}
return
FALSE
;
$data
=
explode
(
'://'
,
$uri
,
2
);
// Remove erroneous leading or trailing, forward-slashes and backslashes.
return
count
(
$data
)
==
2
?
trim
(
$data
[
1
],
'\/'
)
:
FALSE
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
includes/stream_wrappers.inc
+
15
−
20
View file @
ed125d48
...
...
@@ -145,24 +145,6 @@ public function getUri();
*/
public
function
getExternalUrl
();
/**
* Returns the local writable target of the resource within the stream.
*
* This function should be used in place of calls to realpath() or similar
* functions when attempting to determine the location of a file. While
* functions like realpath() may return the location of a read-only file, this
* method may return a URI or path suitable for writing that is completely
* separate from the URI used for reading.
*
* @param $uri
* Optional URI.
*
* @return
* Returns a string representing a location suitable for writing of a file,
* or FALSE if unable to write to the file such as with read-only streams.
*/
public
function
getTarget
(
$uri
=
NULL
);
/**
* Returns the MIME type of the resource.
*
...
...
@@ -286,9 +268,22 @@ function getUri() {
}
/**
* Base implementation of getTarget().
* Returns the local writable target of the resource within the stream.
*
* This function should be used in place of calls to realpath() or similar
* functions when attempting to determine the location of a file. While
* functions like realpath() may return the location of a read-only file, this
* method may return a URI or path suitable for writing that is completely
* separate from the URI used for reading.
*
* @param $uri
* Optional URI.
*
* @return
* Returns a string representing a location suitable for writing of a file,
* or FALSE if unable to write to the file such as with read-only streams.
*/
function
getTarget
(
$uri
=
NULL
)
{
protected
function
getTarget
(
$uri
=
NULL
)
{
if
(
!
isset
(
$uri
))
{
$uri
=
$this
->
uri
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment