Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3335,13 +3335,30 @@ |
3336 | 3336 | * Throws a warning that $function is deprecated |
3337 | 3337 | * |
3338 | 3338 | * @param $function String |
| 3339 | + * @param $version String |
3339 | 3340 | * @return null |
3340 | 3341 | */ |
3341 | | -function wfDeprecated( $function ) { |
| 3342 | +function wfDeprecated( $function, $version=false ) { |
3342 | 3343 | static $functionsWarned = array(); |
3343 | 3344 | if ( !isset( $functionsWarned[$function] ) ) { |
3344 | 3345 | $functionsWarned[$function] = true; |
3345 | | - wfWarn( "Use of $function is deprecated.", 2 ); |
| 3346 | + if ( $version ) { |
| 3347 | + global $wgDeprecationReleaseLimit; |
| 3348 | + if ( $wgDeprecationReleaseLimit ) { |
| 3349 | + # Strip -* off the end of $version so that branches can use the |
| 3350 | + # format #.##-branchname to avoid issues if the branch is merged into |
| 3351 | + # a version of MediaWiki later than what it was branched from |
| 3352 | + $comparableVersion = preg_replace( '/-.*$/', '', $version ); |
| 3353 | + # If the comparableVersion is larger than our release limit then |
| 3354 | + # skip the warning message for the deprecation |
| 3355 | + if ( version_compare( $wgDeprecationReleaseLimit, $comparableVersion, '<' ) ) { |
| 3356 | + return; |
| 3357 | + } |
| 3358 | + } |
| 3359 | + wfWarn( "Use of $function was deprecated in $version.", 2 ); |
| 3360 | + } else { |
| 3361 | + wfWarn( "Use of $function is deprecated.", 2 ); |
| 3362 | + } |
3346 | 3363 | } |
3347 | 3364 | } |
3348 | 3365 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -4039,6 +4039,13 @@ |
4040 | 4040 | */ |
4041 | 4041 | $wgDevelopmentWarnings = false; |
4042 | 4042 | |
| 4043 | +/** |
| 4044 | + * Release limitation to wfDeprecated warnings, if set to a release number |
| 4045 | + * development warnings will not be generated for deprecations added in releases |
| 4046 | + * after the limit. |
| 4047 | + */ |
| 4048 | +$wgDeprecationReleaseLimit = false; |
| 4049 | + |
4043 | 4050 | /** Only record profiling info for pages that took longer than this */ |
4044 | 4051 | $wgProfileLimit = 0.0; |
4045 | 4052 | |