From: Brion Vibber Date: Fri, 26 May 2006 01:03:34 +0000 (+0000) Subject: * wfHostname() function for consistent server hostname use in debug messages X-Git-Tag: 1.31.0-rc.0~57031 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=cb504bfe415f7d63e68e4a24ea846e1099ff705a;p=lhc%2Fweb%2Fwiklou.git * wfHostname() function for consistent server hostname use in debug messages * Send thumbnailing error messages to 'thumbnail' log group --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4c32a65af7..e558d203f3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -337,6 +337,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fixed hardcoded 'done.' when removing watchlist entries. * (bug 5962) Update for Italian language (it) * (bug 6086) Remove vestigial attempt to call Article::validate() +* wfHostname() function for consistent server hostname use in debug messages +* Send thumbnailing error messages to 'thumbnail' log group == Compatibility == diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ced28cf35d..e76b41d606 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -671,6 +671,27 @@ function wfDebugDieBacktrace( $msg = '' ) { die( -1 ); } +/** + * Fetch server name for use in error reporting etc. + * Use real server name if available, so we know which machine + * in a server farm generated the current page. + * @return string + */ +function wfHostname() { + if ( function_exists( 'posix_uname' ) ) { + // This function not present on Windows + $uname = @posix_uname(); + } else { + $uname = false; + } + if( is_array( $uname ) && isset( $uname['nodename'] ) ) { + return $uname['nodename']; + } else { + # This may be a virtual server. + return $_SERVER['SERVER_NAME']; + } +} + /** * Returns a HTML comment with the elapsed time since request. * This method has no side effects. @@ -684,21 +705,8 @@ function wfDebugDieBacktrace( $msg = '' ) { $start = (float)$sec + (float)$usec; $elapsed = $now - $start; - # Use real server name if available, so we know which machine - # in a server farm generated the current page. - if ( function_exists( 'posix_uname' ) ) { - $uname = @posix_uname(); - } else { - $uname = false; - } - if( is_array( $uname ) && isset( $uname['nodename'] ) ) { - $hostname = $uname['nodename']; - } else { - # This may be a virtual server. - $hostname = $_SERVER['SERVER_NAME']; - } $com = sprintf( "", - $hostname, $elapsed ); + wfHostname(), $elapsed ); return $com; } diff --git a/includes/Image.php b/includes/Image.php index 98ce5b50b2..fd2ce63fac 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1173,6 +1173,9 @@ class Image } } if ( $err !== true ) { + wfDebugLog( 'thumbnail', + sprintf( 'thumbnail failed on %s: "%s" from "%s"', + wfHostname(), trim($err), $cmd ) ); return wfMsg( 'thumbnail_error', $err ); } else { return true;