* wfHostname() function for consistent server hostname use in debug messages

* Send thumbnailing error messages to 'thumbnail' log group
This commit is contained in:
Brion Vibber 2006-05-26 01:03:34 +00:00
parent a75f16b262
commit cb504bfe41
3 changed files with 27 additions and 14 deletions

View file

@ -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 ==

View file

@ -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( "<!-- Served by %s in %01.3f secs. -->",
$hostname, $elapsed );
wfHostname(), $elapsed );
return $com;
}

View file

@ -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;