* $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 ===
* (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 ==
*/
$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
*/
}
/**
- * 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 {
if( isset( $callerfunc['class'] ) )
$func .= $callerfunc['class'] . '::';
$func .= @$callerfunc['function'];
- $msg = "Use of $function is deprecated. Called from $func in $file";
+ $msg .= " [Called from $func in $file]";
+ }
+
+ global $wgDevelopmentWarnings;
+ if ( $wgDevelopmentWarnings ) {
+ trigger_error( $msg, $level );
} else {
- $msg = "Use of $function is deprecated.";
+ wfDebug( "$msg\n" );
}
- wfDebug( "$msg\n" );
}
/**
$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";