[Rt-commit] rt branch, 4.2/deprecated-config-options, created. rt-4.1.6-383-g7df7a81
Alex Vandiver
alexmv at bestpractical.com
Fri Mar 22 16:36:18 EDT 2013
The branch, 4.2/deprecated-config-options has been created
at 7df7a81f547370ecb83fc6d174527104d0f390c4 (commit)
- Log -----------------------------------------------------------------
commit bdb5214e7ff982e502bd5d8ecd4274485a9fa14b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Mar 18 22:12:53 2013 -0400
Make stack traces optional in RT->Deprecated
diff --git a/lib/RT.pm b/lib/RT.pm
index d31e4fa..d079708 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -852,6 +852,7 @@ sub Deprecated {
Remove => undef,
Instead => undef,
Message => undef,
+ Stack => 1,
@_,
);
@@ -884,7 +885,7 @@ sub Deprecated {
$msg .= " You should use $args{Instead} instead."
if $args{Instead};
- $msg .= " Call stack:\n$stack";
+ $msg .= " Call stack:\n$stack" if $args{Stack};
RT->Logger->warn($msg);
}
commit 7df7a81f547370ecb83fc6d174527104d0f390c4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Mar 18 22:13:15 2013 -0400
Provide a simple way to note that a config option has been deprecated
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 10fff8e..1ecd6e1 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -764,39 +764,15 @@ our %META = (
},
},
LogToScreen => {
- PostSet => sub {
- my $self = shift;
- my $value = shift;
- $self->SetFromConfig(
- Option => \'LogToSTDERR',
- Value => [$value],
- %{$self->Meta('LogToScreen')->{'Source'}}
- );
- },
- PostLoadCheck => sub {
- my $self = shift;
- # XXX: deprecated, remove in 4.4
- $RT::Logger->info("You set \$LogToScreen in your config, but it's been renamed to \$LogToSTDERR. Please update your config.")
- if $self->Meta('LogToScreen')->{'Source'}{'Package'};
+ Deprecated => {
+ Instead => 'LogToSTDERR',
+ Remove => '4.4',
},
},
UserAutocompleteFields => {
- PostSet => sub {
- my $self = shift;
- my $value = shift;
- $self->SetFromConfig(
- Option => \'UserSearchFields',
- Value => [$value],
- %{$self->Meta('UserAutocompleteFields')->{'Source'}}
- );
- },
- PostLoadCheck => sub {
- my $self = shift;
- RT->Deprecated(
- Message => '$UserAutocompleteFields is deprecated',
- Instead => '$UserSearchFields',
- Remove => "4.4"
- ) if $self->Meta('UserAutocompleteFields')->{'Source'}{'Package'};
+ Deprecated => {
+ Instead => 'UserSearchFields',
+ Remove => '4.4',
},
},
CustomFieldGroupings => {
@@ -1168,6 +1144,22 @@ sub Set {
$META{$name}->{'Type'} = $type;
$META{$name}->{'PostSet'}->($self, $OPTIONS{$name}, $old)
if $META{$name}->{'PostSet'};
+ if ($META{$name}->{'Deprecated'}) {
+ my %deprecated = %{$META{$name}->{'Deprecated'}};
+ my $new_var = $deprecated{Instead} || '';
+ $self->SetFromConfig(
+ Option => \$new_var,
+ Value => [$OPTIONS{$name}],
+ %{$self->Meta($name)->{'Source'}}
+ ) if $new_var;
+ $META{$name}->{'PostLoadCheck'} ||= sub {
+ RT->Deprecated(
+ Message => "Configuration option $name is deprecated",
+ Stack => 0,
+ %deprecated,
+ );
+ };
+ }
return $self->_ReturnValue( $old, $type );
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list