Remove long-redundant phpBB3 support code

This commit is contained in:
Chris 2019-05-27 13:41:51 +01:00
parent 6a80c10f70
commit 9e9e530465
4 changed files with 9 additions and 1100 deletions

View File

@ -76,12 +76,10 @@ BEGIN {
# If a relative path is provided, it is assumed to be relative to the index.cgi # If a relative path is provided, it is assumed to be relative to the index.cgi
# - `scriptpath`, the path to the directory containing index.cgi. This is needed for # - `scriptpath`, the path to the directory containing index.cgi. This is needed for
# scripts running inside mod_perl that may not have cwd set correctly. # scripts running inside mod_perl that may not have cwd set correctly.
# - `use_phpbb`, if set, the phpBB3 support module is loaded (and takes over auth: the
# `auth` argument is ignored if `use_phpbb` is set).
# - `appuser`, a reference to a Webperl::AppUser subclass object to do application-specific # - `appuser`, a reference to a Webperl::AppUser subclass object to do application-specific
# user tasks during auth. Can be omitted if use_phpbb is set. # user tasks during auth.
# - `auth`, an optional reference to an auth object. If not specified, and `use_phpbb` # - `auth`, an optional reference to an auth object. If not specified, a Webperl::Auth
# is not set, a Webperl::Auth object is made for you. # object is made for you.
# - `block_selector`, an optional reference to a Webperl::BlockSelector subclass. If not # - `block_selector`, an optional reference to a Webperl::BlockSelector subclass. If not
# specified, the default Webperl::BlockSelector is used instead to provide standard # specified, the default Webperl::BlockSelector is used instead to provide standard
# block selection behaviour. # block selection behaviour.
@ -99,7 +97,6 @@ sub new {
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
my $self = { my $self = {
config => "config/site.cfg", config => "config/site.cfg",
use_phpbb => 0,
post_max => 128, post_max => 128,
@_, @_,
}; };
@ -168,23 +165,6 @@ sub run {
settings => $self -> {"settings"}) settings => $self -> {"settings"})
or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "Application: Unable to create template handling object: ".$Webperl::Template::errstr); or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "Application: Unable to create template handling object: ".$Webperl::Template::errstr);
# If phpbb mode is enabled, it takes over auth.
if($self -> {"use_phpbb"}) {
load Webperl::phpBB3;
$self -> {"phpbb"} = Webperl::phpBB3 -> new(logger => $self -> {"logger"},
prefix => $self -> {"settings"} -> {"database"} -> {"phpbb_prefix"},
cgi => $self -> {"cgi"},
data_src => $self -> {"settings"} -> {"database"} -> {"phpbb_database"},
username => $self -> {"settings"} -> {"database"} -> {"phpbb_username"},
password => $self -> {"settings"} -> {"database"} -> {"phpbb_password"},
codepath => path_join($self -> {"settings"} -> {"config"} -> {"base"}, "templates", "default"),
url => $self -> {"settings"} -> {"config"} -> {"forumurl"})
or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "Unable to create phpbb object: ".$Webperl::phpBB3::errstr);
$self -> {"auth"} = $self -> {"phpbb"};
# phpBB3 is not enabled, initialise the auth modules.
} else {
# Initialise the appuser object # Initialise the appuser object
$self -> {"appuser"} -> init($self -> {"cgi"}, $self -> {"dbh"}, $self -> {"settings"}, $self -> {"logger"}); $self -> {"appuser"} -> init($self -> {"cgi"}, $self -> {"dbh"}, $self -> {"settings"}, $self -> {"logger"});
@ -193,7 +173,6 @@ sub run {
# Initialise the auth object # Initialise the auth object
$self -> {"auth"} -> init($self -> {"cgi"}, $self -> {"dbh"}, $self -> {"appuser"}, $self -> {"settings"}, $self -> {"logger"}); $self -> {"auth"} -> init($self -> {"cgi"}, $self -> {"dbh"}, $self -> {"appuser"}, $self -> {"settings"}, $self -> {"logger"});
}
# Start the session engine... # Start the session engine...
$self -> {"session"} = Webperl::SessionHandler -> new(logger => $self -> {"logger"}, $self -> {"session"} = Webperl::SessionHandler -> new(logger => $self -> {"logger"},
@ -225,7 +204,6 @@ sub run {
settings => $self -> {"settings"}, settings => $self -> {"settings"},
template => $self -> {"template"}, template => $self -> {"template"},
session => $self -> {"session"}, session => $self -> {"session"},
phpbb => $self -> {"phpbb"}, # this will handily be undef if phpbb mode is disabled
blockdir => $self -> {"settings"} -> {"paths"} -> {"blocks"} || "blocks", blockdir => $self -> {"settings"} -> {"paths"} -> {"blocks"} || "blocks",
system => $self -> {"system"}, system => $self -> {"system"},
messages => $self -> {"messages"}) messages => $self -> {"messages"})
@ -240,7 +218,6 @@ sub run {
settings => $self -> {"settings"}, settings => $self -> {"settings"},
template => $self -> {"template"}, template => $self -> {"template"},
session => $self -> {"session"}, session => $self -> {"session"},
phpbb => $self -> {"phpbb"},
modules => $self -> {"modules"}, modules => $self -> {"modules"},
messages => $self -> {"messages"}) messages => $self -> {"messages"})
or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "Application: Unable to create system object: ".$self -> {"system"} -> errstr()); or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "Application: Unable to create system object: ".$self -> {"system"} -> errstr());

View File

@ -51,7 +51,6 @@ use HTML::Entities;
# - `args` Any arguments passed to the plugin at runtime, usually pulled from the database. # - `args` Any arguments passed to the plugin at runtime, usually pulled from the database.
# - `cgi` A reference to the script's CGI object. # - `cgi` A reference to the script's CGI object.
# - `dbh` A database handle to talk to the database through. # - `dbh` A database handle to talk to the database through.
# - `phpbb` A phpbb3 handle object used to perform operations on a phpbb3 database.
# - `template` A template engine module object to load templates through. # - `template` A template engine module object to load templates through.
# - `settings` The global configuration hashref. # - `settings` The global configuration hashref.
# - `session` A reference to the current session object # - `session` A reference to the current session object

View File

@ -80,10 +80,6 @@
# from the point of view of using the id as part of session id calculation. The extra # from the point of view of using the id as part of session id calculation. The extra
# argument allows the addition of an arbitrary string to the seed used to create the id. # argument allows the addition of an arbitrary string to the seed used to create the id.
# #
# This code is heavily based around the session code used by phpBB3, with
# features removed or added to fit the different requirements of the
# framework.
#
# This class requires three database tables: one for sessions, one for session keys (used # This class requires three database tables: one for sessions, one for session keys (used
# for autologin), and one for session variables. If autologins are permanently disabled # for autologin), and one for session variables. If autologins are permanently disabled
# (that is, you can guarantee that `get_config("allow_autologin")` always returns false) # (that is, you can guarantee that `get_config("allow_autologin")` always returns false)

File diff suppressed because it is too large Load Diff