X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp.php;h=ec03829933d8478ea81b6c53ecfe6b1d7ccfadf7;hb=64718b53d1733df0dcd758fb50cf5b215ccc0832;hp=d671c5f1abf3ffbff872cd47924e911ecfe1da45;hpb=de9cddc82f2c1e250a2f25fc48a97f40e5080c6d;p=friendica.git diff --git a/src/App.php b/src/App.php index d671c5f1ab..ec03829933 100644 --- a/src/App.php +++ b/src/App.php @@ -100,6 +100,7 @@ class App { */ public $template_engine_instance = array(); public $process_id; + public $queue; private $ldelim = array( 'internal' => '', 'smarty3' => '{{' @@ -326,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() { @@ -406,7 +427,7 @@ class App { $this->hostname = Config::get('config', 'hostname'); } - if (!isset($this->hostname) OR ( $this->hostname == '')) { + if (!isset($this->hostname) || ( $this->hostname == '')) { $this->hostname = $hostname; } } @@ -797,6 +818,8 @@ class App { * @return bool Is the limit reached? */ function max_processes_reached() { + // Deactivated, needs more investigating if this check really makes sense + return false; if ($this->is_backend()) { $process = 'backend'; @@ -848,7 +871,7 @@ class App { $meminfo[$key] = (int) ($meminfo[$key] / 1024); } - if (!isset($meminfo['MemAvailable']) OR ! isset($meminfo['MemFree'])) { + if (!isset($meminfo['MemAvailable']) || ! isset($meminfo['MemFree'])) { return false; } @@ -905,7 +928,7 @@ class App { $cachekey = 'app:proc_run:started'; $result = Cache::get($cachekey); - if (!is_null($result) AND ( time() - $result) < 2) { + if (!is_null($result) && ( time() - $result) < 2) { return; } @@ -947,7 +970,7 @@ class App { * @return string system username */ static function systemuser() { - if (!function_exists('posix_getpwuid') OR ! function_exists('posix_geteuid')) { + if (!function_exists('posix_getpwuid') || ! function_exists('posix_geteuid')) { return ''; } @@ -978,7 +1001,7 @@ class App { logger('Path "' . $directory . '" is not a directory for user ' . self::systemuser(), LOGGER_DEBUG); return false; } - if ($check_writable AND !is_writable($directory)) { + if ($check_writable && !is_writable($directory)) { logger('Path "' . $directory . '" is not writable for user ' . self::systemuser(), LOGGER_DEBUG); return false; }