From: Tim Düsterhus Date: Sun, 3 Jul 2016 15:28:02 +0000 (+0200) Subject: Comment functions in core.functions.php X-Git-Tag: 3.0.0_Beta_1~1271 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15de71ce8ef9e389a5c11f54e89f41c54b8b72ca;p=GitHub%2FWoltLab%2FWCF.git Comment functions in core.functions.php --- diff --git a/wcfsetup/install/files/lib/core.functions.php b/wcfsetup/install/files/lib/core.functions.php index 71a767e8dd..2e16f5f909 100644 --- a/wcfsetup/install/files/lib/core.functions.php +++ b/wcfsetup/install/files/lib/core.functions.php @@ -86,7 +86,14 @@ namespace wcf\functions\exception { use wcf\system\exception\SystemException; use wcf\util\FileUtil; use wcf\util\StringUtil; - + + /** + * Logs the given Throwable. + * + * @param \Throwable|\Exception $e + * @param string $logFile The log file to use. If set to `null` the default log file will be used and the variable contents will be replaced by the actual path. + * @return string The ID of the log entry. + */ function logThrowable($e, &$logFile = null) { if ($logFile === null) $logFile = WCF_DIR . 'log/' . gmdate('Y-m-d', TIME_NOW) . '.txt'; touch($logFile); @@ -137,6 +144,13 @@ namespace wcf\functions\exception { return $exceptionID; } + /** + * Pretty prints the given Throwable. It is recommended to `exit;` + * the request after calling this function. + * + * @param \Throwable|\Exception $e + * @throws \Exception + */ function printThrowable($e) { $exceptionID = logThrowable($e, $logFile); @@ -528,6 +542,14 @@ EXPLANATION; getTrace(); @@ -565,6 +587,12 @@ EXPLANATION; }, $trace); } + /** + * Returns the given path relative to `WCF_DIR`, unless both, + * `EXCEPTION_PRIVACY` is `public` and the debug mode is enabled. + * + * @return string + */ function sanitizePath($path) { if (WCF::debugModeIsEnabled() && defined('EXCEPTION_PRIVACY') && EXCEPTION_PRIVACY === 'public') { return $path;