Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: stable
...
compare: 4.2/auto-reload-config
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 18, 2012
@sunnavy sunnavy don't reload configs by Module::Refresh->refresh
though configs are '.pm', they can't be simply reloaded like normal modules.
see #19261
230b502
@sunnavy sunnavy restart server to reload configs
most config items can be reloaded, but ones related to Plugins or Logs can
not, and server won't change its port either even if $WebPort is changed.
7830286
Commits on Jan 19, 2012
@sunnavy sunnavy don't try to restart server in install mode
because we write config several times during the install wizard
b7ceceb
Commits on Jan 23, 2012
@sunnavy sunnavy RT::Interface::Web is not simple reloadable, restart server instead.
error is: RT::Interface::Web::HandleRequest: Can't undef active subroutine
stacktrace starts at share/html/autohandler:53
2586581
View
16 lib/RT.pm
@@ -788,6 +788,22 @@ sub StyleSheets {
return RT->Config->Get('CSSFiles');
}
+=head2 RefreshModules
+
+Refresh modified modules except config.
+
+=cut
+
+sub RefreshModules {
+ require Module::Refresh;
+ my %config = Config->LoadedConfigs();
+
+ for my $mod ( keys %INC ) {
+ next if exists $config{$mod};
+ Module::Refresh->refresh_module_if_modified($mod);
+ }
+}
+
=head1 BUGS
Please report them to rt-bugs@bestpractical.com, if you know what's
View
25 lib/RT/Config.pm
@@ -1326,6 +1326,31 @@ sub UpdateOption {
return 1;
}
+=head2 LoadedConfigs
+
+Returns a hash of loaded config files, with filename as the key and path as
+the value.
+
+=cut
+
+sub LoadedConfigs {
+
+ my %config =
+ map { $_ => $INC{$_} } grep { /^\w+_(?:Site)?Config\.pm$/ } keys %INC;
+ return %config;
+}
+
+=head2 UnloadConfigsFromINC
+
+Unload config files from %INC
+
+=cut
+
+sub UnloadConfigsFromINC {
+ my %config = LoadedConfigs();
+ delete $INC{$_} for keys %config;
+}
+
RT::Base->_ImportOverlays();
1;
View
5 lib/RT/Interface/Web.pm
@@ -211,9 +211,8 @@ sub WebExternalAutoInfo {
sub HandleRequest {
my $ARGS = shift;
- if (RT->Config->Get('DevelMode')) {
- require Module::Refresh;
- Module::Refresh->refresh;
+ if ( RT->Config->Get('DevelMode') ) {
+ RT->RefreshModules;
}
$HTML::Mason::Commands::r->content_type("text/html; charset=utf-8");
View
24 sbin/rt-server.in
@@ -209,6 +209,14 @@ else {
push @args, '--server', 'Standalone' if RT->InstallMode;
push @args, '--server', 'Starlet' unless $r->{server} || grep { m/--server/ } @args;
+if ( !RT->InstallMode && RT->Config->Get('DevelMode') ) {
+ my %config = RT->Config->LoadedConfigs();
+ push @args, '-R', join ',', $INC{'RT/Interface/Web.pm'}, values %config;
+
+ # unload here so we can reload them later
+ RT->Config->UnloadConfigsFromINC();
+}
+
$r->parse_options(@args);
delete $r->{options} if $is_fastcgi; ### mangle_host_port_socket ruins everything
@@ -222,7 +230,21 @@ unless ($r->{env} eq 'development') {
print STDERR "$name: Accepting connections at $proto://$host:$args->{port}/\n";
};
}
-eval { $r->run($app) };
+
+if ( !RT->InstallMode && RT->Config->Get('DevelMode') ) {
+ eval {
+ $r->run(
+ sub {
+ RT->LoadConfig;
+ $app->(@_);
+ }
+ );
+ };
+}
+else {
+ eval { $r->run($app) };
+}
+
if (my $err = $@) {
handle_startup_error($err);
}

No commit comments for this range

Something went wrong with that request. Please try again.