r105979 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105978‎ | r105979 | r105980 >
Date:04:42, 13 December 2011
Author:jeroendedauw
Status:resolved (Comments)
Tags:
Comment:
add support for passing a component arg to this function, so it can be used by extensions as well (ie function foo depracted in extension bar 4.2)
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -3444,27 +3444,35 @@
34453445 * Throws a warning that $function is deprecated
34463446 *
34473447 * @param $function String
3448 - * @param $version String
 3448+ * @param $version String|false: Added in 1.19.
 3449+ * @param $component String|false: Added in 1.19.
 3450+ *
34493451 * @return null
34503452 */
3451 -function wfDeprecated( $function, $version = false ) {
 3453+function wfDeprecated( $function, $version = false, $component = false ) {
34523454 static $functionsWarned = array();
 3455+
34533456 if ( !isset( $functionsWarned[$function] ) ) {
34543457 $functionsWarned[$function] = true;
 3458+
34553459 if ( $version ) {
34563460 global $wgDeprecationReleaseLimit;
 3461+
34573462 if ( $wgDeprecationReleaseLimit ) {
34583463 # Strip -* off the end of $version so that branches can use the
34593464 # format #.##-branchname to avoid issues if the branch is merged into
34603465 # a version of MediaWiki later than what it was branched from
34613466 $comparableVersion = preg_replace( '/-.*$/', '', $version );
 3467+
34623468 # If the comparableVersion is larger than our release limit then
34633469 # skip the warning message for the deprecation
34643470 if ( version_compare( $wgDeprecationReleaseLimit, $comparableVersion, '<' ) ) {
34653471 return;
34663472 }
34673473 }
3468 - wfWarn( "Use of $function was deprecated in $version.", 2 );
 3474+
 3475+ $component = $component === false ? 'MediaWiki' : $component;
 3476+ wfWarn( "Use of $function was deprecated in $component $version.", 2 );
34693477 } else {
34703478 wfWarn( "Use of $function is deprecated.", 2 );
34713479 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r106037Follow up to r105979;jeroendedauw15:49, 13 December 2011

Comments

#Comment by Nikerabbit (talk | contribs)   06:06, 13 December 2011

But this doesn't play nice with $wgDeprecationReleaseLimit?

#Comment by Jeroen De Dauw (talk | contribs)   15:50, 13 December 2011

Good point, addressed in follow up.

Status & tagging log