mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Fix to use foreign_defined sub instead
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -58,7 +58,7 @@ foreach $o (@lang_order_list) {
|
||||
}
|
||||
|
||||
# Call any config pre-load function
|
||||
if (&foreign_func_exists($module, 'config_pre_load')) {
|
||||
if (&foreign_defined($module, 'config_pre_load')) {
|
||||
&foreign_call($module, "config_pre_load", \%info, \@info_order);
|
||||
&foreign_call($module, "config_pre_load", \%einfo);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ if ($section) {
|
||||
# prevent changing behaviour of a module
|
||||
if (&foreign_exists($module) &&
|
||||
&foreign_require($module) &&
|
||||
&foreign_func_exists($module, 'config_pre_load')) {
|
||||
&foreign_defined($module, 'config_pre_load')) {
|
||||
&foreign_call($module, "config_pre_load", \%info, \@info_order);
|
||||
}
|
||||
|
||||
|
||||
2
help.cgi
2
help.cgi
@@ -26,7 +26,7 @@ $help || &helperror(&text('help_efile3',
|
||||
# Modify help file based on module
|
||||
if (&foreign_exists($module) &&
|
||||
&foreign_require($module) &&
|
||||
&foreign_func_exists($module, 'help_pre_load')) {
|
||||
&foreign_defined($module, 'help_pre_load')) {
|
||||
$help = &foreign_call($module, "help_pre_load", $help);
|
||||
}
|
||||
|
||||
|
||||
@@ -3783,25 +3783,6 @@ my $mdir = &module_root_directory($_[0]);
|
||||
return -r "$mdir/module.info";
|
||||
}
|
||||
|
||||
=head2 foreign_func_exists(module, func)
|
||||
|
||||
Checks if module exists and if the
|
||||
given module's function is defined
|
||||
|
||||
=cut
|
||||
sub foreign_func_exists
|
||||
{
|
||||
my ($mod, $func) = @_;
|
||||
if (&foreign_exists($mod)) {
|
||||
$mod =~ s/-/_/g;
|
||||
$func = "${mod}::${func}";
|
||||
if (defined(&$func)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
=head2 foreign_available(module)
|
||||
|
||||
Returns 1 if some module is installed, and accessible to the current user. The
|
||||
@@ -4032,9 +4013,9 @@ simpler to use the syntax &defined(module::function) instead.
|
||||
=cut
|
||||
sub foreign_defined
|
||||
{
|
||||
my ($pkg) = @_;
|
||||
my ($pkg, $sub) = @_;
|
||||
$pkg =~ s/[^A-Za-z0-9]/_/g;
|
||||
my $func = "${pkg}::$_[1]";
|
||||
my $func = "${pkg}::${sub}";
|
||||
return defined(&$func);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user