[Rt-commit] rt branch, 4.2/build-table-attributes, created. rt-4.1.13-28-gce05f17
Alex Vandiver
alexmv at bestpractical.com
Mon Jun 24 17:21:52 EDT 2013
The branch, 4.2/build-table-attributes has been created
at ce05f17e934ddd280a10861990f5e7503860c276 (commit)
- Log -----------------------------------------------------------------
commit 93fd136a4c4cfec3264dccdd21bfe104fb69eb7c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Jun 24 16:52:50 2013 -0400
Refactor rebuilding table attributes into a method
diff --git a/lib/RT.pm b/lib/RT.pm
index 368770a..7fa9b57 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -480,6 +480,30 @@ sub InitClasses {
require RT::Topic;
require RT::Topics;
+ $self->_BuildTableAttributes;
+
+ if ( $args{'Heavy'} ) {
+ # load scrips' modules
+ my $scrips = RT::Scrips->new(RT->SystemUser);
+ while ( my $scrip = $scrips->Next ) {
+ local $@;
+ eval { $scrip->LoadModules } or
+ $RT::Logger->error("Invalid Scrip ".$scrip->Id.". Unable to load the Action or Condition. ".
+ "You should delete or repair this Scrip in the admin UI.\n$@\n");
+ }
+
+ foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) {
+ local $@;
+ eval "require $class; 1" or $RT::Logger->error(
+ "Class '$class' is listed in CustomFieldValuesSources option"
+ ." in the config, but we failed to load it:\n$@\n"
+ );
+ }
+
+ }
+}
+
+sub _BuildTableAttributes {
# on a cold server (just after restart) people could have an object
# in the session, as we deserialize it so we never call constructor
# of the class, so the list of accessible fields is empty and we die
@@ -513,26 +537,6 @@ sub InitClasses {
RT::ObjectTopic
RT::Topic
);
-
- if ( $args{'Heavy'} ) {
- # load scrips' modules
- my $scrips = RT::Scrips->new(RT->SystemUser);
- while ( my $scrip = $scrips->Next ) {
- local $@;
- eval { $scrip->LoadModules } or
- $RT::Logger->error("Invalid Scrip ".$scrip->Id.". Unable to load the Action or Condition. ".
- "You should delete or repair this Scrip in the admin UI.\n$@\n");
- }
-
- foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) {
- local $@;
- eval "require $class; 1" or $RT::Logger->error(
- "Class '$class' is listed in CustomFieldValuesSources option"
- ." in the config, but we failed to load it:\n$@\n"
- );
- }
-
- }
}
=head2 InitSystemObjects
commit ce05f17e934ddd280a10861990f5e7503860c276
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Jun 24 16:53:05 2013 -0400
Rebuild record attributes after loading plugins
Plugins may provide _LocalAccessible methods in an attempt to modify
which attriutes are public. However, as InitClasses() is called prior
to InitPlugins(), the _BuildTableAttributes call is too early to be
affected by plugins' changes.
Add an additional _BuildTableAttributes call after plugins are loaded.
In order to preserve the previous behavior, do not remove the previous
callsite. Otherwise, code which called InitClasses directly would not
have a working set of classes, and load-time code in plugins would not
be able to use the core classes' SearchBuilder-constructed methods.
diff --git a/lib/RT.pm b/lib/RT.pm
index 7fa9b57..8343713 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -195,6 +195,7 @@ sub Init {
InitClasses();
InitLogging();
InitPlugins();
+ _BuildTableAttributes;
RT::I18N->Init;
RT->Config->PostLoadCheck;
RT::Lifecycle->new->FillCache;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list