'ApiOpenSearchSuggest': Called when constructing the OpenSearch results. Hooks
can alter or append to the array.
-&$results: array of associative arrays. Keys are:
+&$results: array with integer keys to associative arrays. Keys in associative
+array:
- title: Title object.
- redirect from: Title or null.
- extract: Description for this result.
'ImgAuthBeforeStream': executed before file is streamed to user, but only when
using img_auth.php.
&$title: the Title object of the file as it would appear for the upload page
- &$path: the original file and path name when img_auth was invoked by the the web
+ &$path: the original file and path name when img_auth was invoked by the web
server
&$name: the name only component of the file
&$result: The location to pass back results of the hook routine (only used if
}
/**
- * Send a line to a supplementary debug log file, if configured, or main debug log if not.
- * To configure a supplementary log file, set $wgDebugLogGroups[$logGroup] to a string
- * filename or an associative array mapping 'destination' to the desired filename. The
- * associative array may also contain a 'sample' key with an integer value, specifying
- * a sampling factor.
+ * Send a line to a supplementary debug log file, if configured, or main debug
+ * log if not.
+ *
+ * To configure a supplementary log file, set $wgDebugLogGroups[$logGroup] to
+ * a string filename or an associative array mapping 'destination' to the
+ * desired filename. The associative array may also contain a 'sample' key
+ * with an integer value, specifying a sampling factor. Sampled log events
+ * will be emitted with a 1 in N random chance.
*
* @since 1.23 support for sampling log messages via $wgDebugLogGroups.
* @since 1.25 support for additional context data
+ * @since 1.25 sample behavior dependent on configured $wgMWLoggerDefaultSpi
*
* @param string $logGroup
* @param string $text
$logger = MWLogger::getInstance( $logGroup );
$context['private'] = ( $dest === 'private' );
- $logger->debug( $text, $context );
+ $logger->info( $text, $context );
}
/**
* @param string $file Filename
* @param array $context Additional logging context data
* @throws MWException
+ * @deprecated since 1.25 Use MWLoggerLegacyLogger::emit or UDPTransport
*/
function wfErrorLog( $text, $file, array $context = array() ) {
+ wfDeprecated( __METHOD__, '1.25' );
$logger = MWLogger::getInstance( 'wfErrorLog' );
$context['destination'] = $file;
$logger->info( trim( $text ), $context );
/**
* Get a cache object.
*
- * @param int $inputType Cache type, one the the CACHE_* constants.
+ * @param int $inputType Cache type, one of the CACHE_* constants.
* @return BagOStuff
*/
function wfGetCache( $inputType ) {
// and no explicit wgDebugLogGroups configuration.
$shouldEmit = false;
} else {
- // Default return value is the the same as the historic wfDebug
+ // Default return value is the same as the historic wfDebug
// method: emit if $wgDebugLogFile has been set.
$shouldEmit = $wgDebugLogFile != '';
}
*/
public static function emit( $text, $file ) {
if ( substr( $file, 0, 4 ) == 'udp:' ) {
- # Needs the sockets extension
- if ( preg_match( '!^udp:(?://)?\[([0-9a-fA-F:]+)\]:(\d+)(?:/(.*))?$!', $file, $m ) ) {
- // IPv6 bracketed host
- $host = $m[1];
- $port = intval( $m[2] );
- $prefix = isset( $m[3] ) ? $m[3] : false;
- $domain = AF_INET6;
- } elseif ( preg_match( '!^udp:(?://)?([a-zA-Z0-9.-]+):(\d+)(?:/(.*))?$!', $file, $m ) ) {
- $host = $m[1];
- if ( !IP::isIPv4( $host ) ) {
- $host = gethostbyname( $host );
- }
- $port = intval( $m[2] );
- $prefix = isset( $m[3] ) ? $m[3] : false;
- $domain = AF_INET;
- } else {
- throw new MWException( __METHOD__ . ': Invalid UDP specification' );
- }
-
- // Clean it up for the multiplexer
- if ( strval( $prefix ) !== '' ) {
- $text = preg_replace( '/^/m', $prefix . ' ', $text );
-
- // Limit to 64KB
- if ( strlen( $text ) > 65506 ) {
- $text = substr( $text, 0, 65506 );
- }
-
- if ( substr( $text, -1 ) != "\n" ) {
- $text .= "\n";
- }
- } elseif ( strlen( $text ) > 65507 ) {
- $text = substr( $text, 0, 65507 );
- }
-
- $sock = socket_create( $domain, SOCK_DGRAM, SOL_UDP );
- if ( !$sock ) {
- return;
- }
-
- socket_sendto( $sock, $text, strlen( $text ), 0, $host, $port );
- socket_close( $sock );
+ $transport = UDPTransport::newFromString( $file );
+ $transport->emit( $text );
} else {
wfSuppressWarnings();
$exists = file_exists( $file );
// Format is <timestamp>!<name>
$bits = explode( '!', $fileName, 2 );
if ( count( $bits ) != 2 ) {
- wfThumbError( 404, wfMessage( 'badtitletext' )->text() );
+ wfThumbError( 404, wfMessage( 'badtitletext' )->parse() );
return;
}
$title = Title::makeTitleSafe( NS_FILE, $bits[1] );
if ( !$title ) {
- wfThumbError( 404, wfMessage( 'badtitletext' )->text() );
+ wfThumbError( 404, wfMessage( 'badtitletext' )->parse() );
return;
}
$img = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $fileName );
// Check the source file title
if ( !$img ) {
- wfThumbError( 404, wfMessage( 'badtitletext' )->text() );
+ wfThumbError( 404, wfMessage( 'badtitletext' )->parse() );
return;
}
return;
}
- // For 404 handled thumbnails, we only use the the base name of the URI
+ // For 404 handled thumbnails, we only use the base name of the URI
// for the thumb params and the parent directory for the source file name.
// Check that the zone relative path matches up so squid caches won't pick
// up thumbs that would not be purged on source file deletion (bug 34231).
$user = RequestContext::getMain()->getUser();
if ( !wfThumbIsStandard( $img, $params ) && $user->pingLimiter( 'renderfile-nonstandard' ) ) {
- wfThumbError( 500, wfMessage( 'actionthrottledtext' ) );
+ wfThumbError( 500, wfMessage( 'actionthrottledtext' )->parse() );
return;
} elseif ( $user->pingLimiter( 'renderfile' ) ) {
- wfThumbError( 500, wfMessage( 'actionthrottledtext' ) );
+ wfThumbError( 500, wfMessage( 'actionthrottledtext' )->parse() );
return;
}
* Output a thumbnail generation error message
*
* @param int $status
- * @param string $msg
+ * @param string $msg HTML
* @return void
*/
function wfThumbError( $status, $msg ) {