* $wgDevelopmentWarnings can be set to true to show warnings about deprecated

functions and other potential errors when developing.
* (bug 14118) SpecialPage::getTitleFor does not return a localised name
This commit is contained in:
Niklas Laxström 2009-05-23 10:14:24 +00:00
parent e3c35ec473
commit 98aa14bc87
4 changed files with 37 additions and 12 deletions

View file

@ -29,6 +29,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* $wgAllowRealName was deprecated in favor of $wgHiddenPrefs[] = 'realname',
but the former is still retained for backwards-compatibility
* (bug 9257) $wgRCMaxAge now defaults to three months
* $wgDevelopmentWarnings can be set to true to show warnings about deprecated
functions and other potential errors when developing.
=== New features in 1.16 ===
@ -147,6 +149,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 18432) Updated documentation for dumpBackup.php
* Fix array logic in Sanitizer::removeHTMLtags so that it doesn't strip good tags
that were redundantly defined.
* (bug 14118) SpecialPage::getTitleFor does not return a localised name
== API changes in 1.16 ==

View file

@ -1087,6 +1087,12 @@ $wgShowExceptionDetails = false;
*/
$wgShowHostnames = false;
/**
* If set to true MediaWiki will throw notices for some possible error
* conditions and for deprecated functions.
*/
$wgDevelopmentWarnings = false;
/**
* Use experimental, DMOZ-like category browser
*/

View file

@ -3012,19 +3012,19 @@ function wfMaxlagError( $host, $lag, $maxLag ) {
}
/**
* Throws an E_USER_NOTICE saying that $function is deprecated
* Throws a warning that $function is deprecated
* @param string $function
* @return null
*/
function wfDeprecated( $function ) {
global $wgDebugLogFile;
if ( !$wgDebugLogFile ) {
return;
}
wfWarn( "Use of $function is deprecated.", 2 );
}
function wfWarn( $msg, $callerOffset = 1, $level = E_USER_NOTICE ) {
$callers = wfDebugBacktrace();
if( isset( $callers[2] ) ){
$callerfunc = $callers[2];
$callerfile = $callers[1];
if( isset( $callers[$callerOffset+1] ) ){
$callerfunc = $callers[$callerOffset+1];
$callerfile = $callers[$callerOffset];
if( isset( $callerfile['file'] ) && isset( $callerfile['line'] ) ){
$file = $callerfile['file'] . ' at line ' . $callerfile['line'];
} else {
@ -3034,11 +3034,15 @@ function wfDeprecated( $function ) {
if( isset( $callerfunc['class'] ) )
$func .= $callerfunc['class'] . '::';
$func .= @$callerfunc['function'];
$msg = "Use of $function is deprecated. Called from $func in $file";
} else {
$msg = "Use of $function is deprecated.";
$msg .= " [Called from $func in $file]";
}
global $wgDevelopmentWarnings;
if ( $wgDevelopmentWarnings ) {
trigger_error( $msg, $level );
} else {
wfDebug( "$msg\n" );
}
wfDebug( "$msg\n" );
}
/**

View file

@ -597,6 +597,18 @@ class SpecialPage
$aliases = $wgContLang->getSpecialPageAliases();
if ( isset( $aliases[$name][0] ) ) {
$name = $aliases[$name][0];
} else {
// Try harder in case someone misspelled the correct casing
$found = false;
foreach ( $aliases as $n => $values ) {
if ( strcasecmp( $name, $n ) === 0 ) {
wfWarn( "Found $n for $name with casefix" );
$name = $values[0];
$found = true;
break;
}
}
if ( !$found ) wfWarn( "Did not found name for special page $name" );
}
if ( $subpage !== false && !is_null( $subpage ) ) {
$name = "$name/$subpage";