mirror of
https://github.com/friendica/friendica
synced 2025-04-27 09:50:12 +00:00
Better use a wrapper
This commit is contained in:
parent
5d7e1e1a15
commit
79fe249c54
3 changed files with 27 additions and 7 deletions
22
src/App.php
22
src/App.php
|
@ -327,7 +327,27 @@ class App {
|
|||
$basepath = $_SERVER['PWD'];
|
||||
}
|
||||
|
||||
return $basepath;
|
||||
return self::realpath($basepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a normalized file path
|
||||
*
|
||||
* This is a wrapper for the "realpath" function.
|
||||
* That function cannot detect the real path when some folders aren't readable.
|
||||
* Since this could happen with some hosters we need to handle this.
|
||||
*
|
||||
* @param string $path The path that is about to be normalized
|
||||
* @return string normalized path - when possible
|
||||
*/
|
||||
public static function realpath($path) {
|
||||
$normalized = realpath($path);
|
||||
|
||||
if (!is_bool($normalized)) {
|
||||
return $normalized;
|
||||
} else {
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
function get_scheme() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue