Skip to content

Commit

Permalink
Merge pull request #6 from virtualmin/dev/enable-module-once
Browse files Browse the repository at this point in the history
Add support for enabling module in postinstall once
  • Loading branch information
jcameron authored Mar 8, 2024
2 parents 59b58c8 + d9ff256 commit 482e8e6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions postinstall.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use strict;
use warnings;
our ($module_name, %gconfig);

do 'virtualmin-htpasswd-lib.pl';

sub module_install
{
# Enable virtualmin-htpasswd module once
my @p = split(/\s+/, $virtual_server::config{'plugins'});
my @ppe = split(/\s+/, $virtual_server::config{'plugins_postinstall_enabled'});
if (&indexof('virtualmin-nginx', @virtual_server::plugins) > -1 &&
&indexof($module_name, @p) == -1 &&
&indexof($module_name, @ppe) == -1) {
&virtual_server::lock_file($virtual_server::module_config_file);
push(@p, $module_name);
push(@ppe, $module_name);
$virtual_server::config{'plugins'} = join(" ", @p);
$virtual_server::config{'plugins_postinstall_enabled'} = join(" ", @ppe);
&virtual_server::save_module_config(\%virtual_server::config, 'virtual-server');
&virtual_server::unlock_file($virtual_server::module_config_file);
}
}

0 comments on commit 482e8e6

Please sign in to comment.