[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-889-gc5f7e07
Chia-liang Kao
clkao at bestpractical.com
Thu Dec 16 03:46:59 EST 2010
The branch, 3.9-trunk has been updated
via c5f7e07b92b2d31795be095c9e95d535888f5452 (commit)
via cfb7fd942163c05d78e95250dbebd4cfe49cb5d6 (commit)
from 27a79bbb05ae0dcd7ee6745c2e7021db1b3c7904 (commit)
Summary of changes:
lib/RT.pm | 2 +-
lib/RT/Plugin.pm | 5 ++++-
sbin/rt-server.in | 4 ++--
share/html/Admin/Global/Plugins.html | 14 +++++++++-----
4 files changed, 16 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit cfb7fd942163c05d78e95250dbebd4cfe49cb5d6
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Thu Dec 16 12:01:55 2010 +0800
make sure plugins enabled by config can't be disabled by the admin ui
diff --git a/lib/RT.pm b/lib/RT.pm
index 639f477..b32972c 100755
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -638,7 +638,7 @@ sub _try_enable_plugin {
return if $plugin->Enabled;
if ( $explicit || -e $plugin->Path(".enabled")) {
- eval { $plugin->Enable; 1 }
+ eval { $plugin->Enable($explicit); 1 }
or do {
# XXX: the rt bootstrapping sequence loads RT_Config
# first, which requires scanning plugin directories,
diff --git a/lib/RT/Plugin.pm b/lib/RT/Plugin.pm
index af0c493..d8771a9 100644
--- a/lib/RT/Plugin.pm
+++ b/lib/RT/Plugin.pm
@@ -73,6 +73,7 @@ use List::MoreUtils qw(first_index);
has _added_inc_path => (is => "rw", isa => "Str");
has Name => (is => "rw", isa => "Str");
has Enabled => (is => "rw", isa => "Bool");
+has ConfigEnabled => (is => "rw", isa => "Bool");
has Description => (is => "rw", isa => "Str");
has BasePath => (is => "rw", isa => "Str");
@@ -88,8 +89,10 @@ sub new {
# it should be the one after local lib
my $inc_anchor;
sub Enable {
- my $self = shift;
+ my ($self, $global) = @_;
my $add = $self->Path("lib");
+ $self->ConfigEnabled(1)
+ if $global;
unless (defined $inc_anchor) {
my $anchor = first_index { Cwd::realpath($_) eq Cwd::realpath($RT::LocalLibPath) } @INC;
$inc_anchor = ($anchor == -1 || $anchor == $#INC) # not found or last
diff --git a/share/html/Admin/Global/Plugins.html b/share/html/Admin/Global/Plugins.html
index 4e79226..f6186bc 100644
--- a/share/html/Admin/Global/Plugins.html
+++ b/share/html/Admin/Global/Plugins.html
@@ -64,12 +64,16 @@
<li class="plugin-<% $enabled ? 'enabled' : 'disabled'%>">
<span class="name"><% $plugin->Name %></span>
<span class="description"><% $plugin->Description || loc("No description") %></span>
+% if ($plugin->ConfigEnabled && 1) {
+<span class="plugin-config">Enabled through RT_Config.pm</span>
+% } else {
<form method="POST">
<input name="PluginName" value="<% $plugin->Name %>" type="hidden" />
<input name="<% $enabled ? 'Disable' : 'Enable' %>"
value="<% $enabled ? loc('Disable') : loc('Enable') %>"
type="submit" class="submit" />
</form>
+% }
</li>
% }
</ul>
@@ -105,7 +109,11 @@ if ($PluginName) {
}
}
elsif ($Disable) {
- if (-e $plugin_enable) {
+ if ($plugin->ConfigEnabled) {
+ push @results, loc("Plugin [_1] is enabled through RT_SiteConfig.pm, please disable it there.",
+ $PluginName);
+ }
+ elsif (-e $plugin_enable) {
if ( eval { unlink($plugin_enable)
or die loc("You need to make the directory [_1] writable first.", $plugin->Path);
RT->RestartRequired(1);
@@ -120,10 +128,6 @@ if ($PluginName) {
push @results, loc("Failed to disable plugin [_1]: [_2].", $PluginName, $@);
}
}
- else {
- push @results, loc("Plugin [_1] is enabled through RT_SiteConfig.pm, please disable it there.",
- $PluginName);
- }
}
}
commit c5f7e07b92b2d31795be095c9e95d535888f5452
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Thu Dec 16 15:58:50 2010 +0800
make full option name so we don't run conflict with potential psgi server args containing the server or port keyword
diff --git a/sbin/rt-server.in b/sbin/rt-server.in
index 611259e..97ad46a 100755
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -174,9 +174,9 @@ my $r = Plack::Runner->new( $0 =~ 'standalone' ? ( server => 'Standalone' ) :
: (),
env => 'deployment' );
my @args = @ARGV;
-push @args, '--port', $port unless grep { m/port/ } @args;
+push @args, '--port', $port unless grep { m/--port/ } @args;
push @args, '--server', 'Standalone' if RT->InstallMode;
-push @args, '--server', 'Starlet' unless $r->{server} || grep { m/server/ } @args;
+push @args, '--server', 'Starlet' unless $r->{server} || grep { m/--server/ } @args;
$r->parse_options(@args);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list