Issue #1201024 by pillarsdotnet, jbrown, tim.plunkett | Damien Tournoud: drupal_realpath() should describe when it should be used.

merge-requests/26/head
David Rothstein 2013-08-06 01:35:38 -04:00
parent f4b5b2c75f
commit 19e85c0593
1 changed files with 8 additions and 16 deletions

View File

@ -2199,29 +2199,21 @@ function drupal_unlink($uri, $context = NULL) {
} }
/** /**
* Returns the absolute local filesystem path of a stream URI. * Resolves the absolute filepath of a local URI or filepath.
* *
* This function was originally written to ease the conversion of 6.x code to * The use of drupal_realpath() is discouraged, because it does not work for
* use 7.x stream wrappers. However, it assumes that every URI may be resolved * remote URIs. Except in rare cases, URIs should not be manually resolved.
* to an absolute local filesystem path, and this assumption fails when stream
* wrappers are used to support remote file storage. Remote stream wrappers
* may implement the realpath method by always returning FALSE. The use of
* drupal_realpath() is discouraged, and is slowly being removed from core
* functions where possible.
* *
* Only use this function if you know that the stream wrapper in the URI uses * Only use this function if you know that the stream wrapper in the URI uses
* the local file system, and you need to pass an absolute path to a function * the local file system, and you need to pass an absolute path to a function
* that is incompatible with stream URIs. * that is incompatible with stream URIs.
* *
* @param $uri * @param string $uri
* A stream wrapper URI or a filesystem path, possibly including one or more * A stream wrapper URI or a filepath, possibly including one or more symbolic
* symbolic links. * links.
* *
* @return * @return string|false
* The absolute local filesystem path (with no symbolic links), or FALSE on * The absolute local filepath (with no symbolic links), or FALSE on failure.
* failure.
*
* @todo This function is deprecated, and should be removed wherever possible.
* *
* @see DrupalStreamWrapperInterface::realpath() * @see DrupalStreamWrapperInterface::realpath()
* @see http://php.net/manual/function.realpath.php * @see http://php.net/manual/function.realpath.php