AppUser subclasses may need access to System modules.

This commit is contained in:
Chris 2012-06-15 13:19:14 +01:00
parent c4b03ea01a
commit 01d3ee2fda
2 changed files with 14 additions and 0 deletions

View File

@ -104,6 +104,17 @@ sub init {
}
## @method void set_system($system)
# Set the AppUser's refrence to the system object. This must be done after both
# construction and initialisation, as the system object may not be available
# at either stage.
#
# @param system A reference to the system System object.
sub set_system {
my $self = shift;
$self -> {"system"} = shift;
}
# ============================================================================
# Constants access

View File

@ -219,6 +219,8 @@ sub run {
phpbb => $self -> {"phpbb"},
modules => $self -> {"modules"})
or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "Application: Unable to create system object: ".$self -> {"system"} -> {"errstr"});
$self -> {"appuser"} -> set_system($self -> {"system"}) if($self -> {"appuser"});
}
# Has a block selector been specified? If not, make a default one
@ -255,6 +257,7 @@ sub run {
# Prevent circular references from messing up shutdown
$self -> {"template"} -> set_module_obj(undef);
$self -> {"system"} -> clear() if($self -> {"system"});
$self -> {"appuser"} -> set_system(undef) if($self -> {"appuser"});
$self -> {"dbh"} -> disconnect();
$self -> {"logger"} -> end_log();