r50933 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50932‎ | r50933 | r50934 >
Date:10:14, 23 May 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
* $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
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -3012,19 +3012,19 @@
30133013 }
30143014
30153015 /**
3016 - * Throws an E_USER_NOTICE saying that $function is deprecated
 3016+ * Throws a warning that $function is deprecated
30173017 * @param string $function
30183018 * @return null
30193019 */
30203020 function wfDeprecated( $function ) {
3021 - global $wgDebugLogFile;
3022 - if ( !$wgDebugLogFile ) {
3023 - return;
3024 - }
 3021+ wfWarn( "Use of $function is deprecated.", 2 );
 3022+}
 3023+
 3024+function wfWarn( $msg, $callerOffset = 1, $level = E_USER_NOTICE ) {
30253025 $callers = wfDebugBacktrace();
3026 - if( isset( $callers[2] ) ){
3027 - $callerfunc = $callers[2];
3028 - $callerfile = $callers[1];
 3026+ if( isset( $callers[$callerOffset+1] ) ){
 3027+ $callerfunc = $callers[$callerOffset+1];
 3028+ $callerfile = $callers[$callerOffset];
30293029 if( isset( $callerfile['file'] ) && isset( $callerfile['line'] ) ){
30303030 $file = $callerfile['file'] . ' at line ' . $callerfile['line'];
30313031 } else {
@@ -3034,11 +3034,15 @@
30353035 if( isset( $callerfunc['class'] ) )
30363036 $func .= $callerfunc['class'] . '::';
30373037 $func .= @$callerfunc['function'];
3038 - $msg = "Use of $function is deprecated. Called from $func in $file";
 3038+ $msg .= " [Called from $func in $file]";
 3039+ }
 3040+
 3041+ global $wgDevelopmentWarnings;
 3042+ if ( $wgDevelopmentWarnings ) {
 3043+ trigger_error( $msg, $level );
30393044 } else {
3040 - $msg = "Use of $function is deprecated.";
 3045+ wfDebug( "$msg\n" );
30413046 }
3042 - wfDebug( "$msg\n" );
30433047 }
30443048
30453049 /**
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1088,6 +1088,12 @@
10891089 $wgShowHostnames = false;
10901090
10911091 /**
 1092+ * If set to true MediaWiki will throw notices for some possible error
 1093+ * conditions and for deprecated functions.
 1094+ */
 1095+$wgDevelopmentWarnings = false;
 1096+
 1097+/**
10921098 * Use experimental, DMOZ-like category browser
10931099 */
10941100 $wgUseCategoryBrowser = false;
Index: trunk/phase3/includes/SpecialPage.php
@@ -597,6 +597,18 @@
598598 $aliases = $wgContLang->getSpecialPageAliases();
599599 if ( isset( $aliases[$name][0] ) ) {
600600 $name = $aliases[$name][0];
 601+ } else {
 602+ // Try harder in case someone misspelled the correct casing
 603+ $found = false;
 604+ foreach ( $aliases as $n => $values ) {
 605+ if ( strcasecmp( $name, $n ) === 0 ) {
 606+ wfWarn( "Found $n for $name with casefix" );
 607+ $name = $values[0];
 608+ $found = true;
 609+ break;
 610+ }
 611+ }
 612+ if ( !$found ) wfWarn( "Did not found name for special page $name" );
601613 }
602614 if ( $subpage !== false && !is_null( $subpage ) ) {
603615 $name = "$name/$subpage";
Index: trunk/phase3/RELEASE-NOTES
@@ -29,6 +29,8 @@
3030 * $wgAllowRealName was deprecated in favor of $wgHiddenPrefs[] = 'realname',
3131 but the former is still retained for backwards-compatibility
3232 * (bug 9257) $wgRCMaxAge now defaults to three months
 33+* $wgDevelopmentWarnings can be set to true to show warnings about deprecated
 34+ functions and other potential errors when developing.
3335
3436 === New features in 1.16 ===
3537
@@ -147,6 +149,7 @@
148150 * (bug 18432) Updated documentation for dumpBackup.php
149151 * Fix array logic in Sanitizer::removeHTMLtags so that it doesn't strip good tags
150152 that were redundantly defined.
 153+* (bug 14118) SpecialPage::getTitleFor does not return a localised name
151154
152155 == API changes in 1.16 ==
153156

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r34850Fix typo in special page name. Not critical but prevents localized special pa...raymond09:07, 15 May 2008

Status & tagging log