Skip to content

Commit

Permalink
RoundcubePlugins plugin: Added missing parameter for the sauserprefs …
Browse files Browse the repository at this point in the history
…plugin

RoundcubePlugins plugin: Several fixes (conditional statements)
  • Loading branch information
nuxwin committed May 24, 2019
1 parent b858aaf commit 78f10a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
22 changes: 11 additions & 11 deletions incubator/RoundcubePlugins/backend/RoundcubePlugins.pm
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ sub enable
for my $repository ( @{ $pluginDef->{'composer'}->{'repositories'} } ) {
next unless ref $repository eq 'HASH'
&& exists $repository->{'type'}
&& ref \$repository->{'type'} eq 'SCALAR'
&& ref \( $repository->{'type'} // \1 ) eq 'SCALAR'
&& length $repository->{'type'}
&& exists $repository->{'url'}
&& ref \$repository->{'url'} eq 'SCALAR'
&& ref \( $repository->{'url'} // \1 ) eq 'SCALAR'
&& length $repository->{'url'};

unless ( grep {
Expand All @@ -155,15 +155,15 @@ sub enable
while ( my ( $package, $version ) = each(
%{ $pluginDef->{'composer'}->{'require'} }
) ) {
next unless ref \$version eq 'SCALAR';
next unless ref \( $version // \1 ) eq 'SCALAR';
$composer->require( $package, $version );
}
}

# Execute the plugin configuration script for the 'preconfigure'
# stage if one is provided
if ( exists $pluginDef->{'config'}->{'script'}
&& ref \$pluginDef->{'config'}->{'script'} eq 'SCALAR'
&& ref \( $pluginDef->{'config'}->{'script'} // \1 ) eq 'SCALAR'
&& length $pluginDef->{'config'}->{'script'}
&& -f $pluginDef->{'config'}->{'script'}
) {
Expand Down Expand Up @@ -261,10 +261,10 @@ sub disable
for my $repository ( @{ $pluginDef->{'composer'}->{'repositories'} } ) {
next unless ref $repository eq 'HASH'
&& exists $repository->{'type'}
&& ref \$repository->{'type'} eq 'SCALAR'
&& ref \( $repository->{'type'} // \1 ) eq 'SCALAR'
&& length $repository->{'type'}
&& exists $repository->{'url'}
&& ref \$repository->{'url'} eq 'SCALAR'
&& ref \( $repository->{'url'} // \1 ) eq 'SCALAR'
&& length $repository->{'url'};

@{ $composerJson->{ 'repositories' } } = grep {
Expand All @@ -277,7 +277,7 @@ sub disable
# Execute the plugin configuration script for the
# 'predeconfigure' stage if one is provided
if ( exists $pluginDef->{'config'}->{'script'}
&& ref \$pluginDef->{'config'}->{'script'} eq 'SCALAR'
&& ref \( $pluginDef->{'config'}->{'script'} // \1 ) eq 'SCALAR'
&& length $pluginDef->{'config'}->{'script'}
&& -f $pluginDef->{'config'}->{'script'}
) {
Expand Down Expand Up @@ -395,7 +395,7 @@ sub _configurePlugins
# Override the default plugin configuration template file with the
# provided one if defined, else look for a default one
my $conffile = exists $config->{'file'}
&& ref \$config->{'file'} eq 'SCALAR'
&& ref \( $config->{'file'} // \1 ) eq 'SCALAR'
&& length $config->{'file'}
? $config->{'file'} : 'config.inc.php.dist';

Expand All @@ -422,7 +422,7 @@ sub _configurePlugins
${ $fileC } .= "\n// i-MSCP Plugin::RoundcubePlugins BEGIN.\n";

if ( exists $config->{'include_file'}
&& ref \$config->{'include_file'} eq 'SCALAR'
&& ref \( $config->{'include_file'} // \1 ) eq 'SCALAR'
&& length $config->{'include_file'}
&& -f $config->{'include_file'}
) {
Expand Down Expand Up @@ -453,7 +453,7 @@ EOT
# Execute the plugin configuration script for the 'configure' stage if
# one is defined
if ( exists $config->{'script'}
&& ref \$config->{'script'} eq 'SCALAR'
&& ref \( $config->{'script'} // \1 ) eq 'SCALAR'
&& length $config->{'script'}
&& -f $config->{'script'}
) {
Expand Down Expand Up @@ -510,7 +510,7 @@ sub _deconfigurePlugins
# Execute the plugin configuration script for the 'deconfigure' stage
# if one is defined
if ( exists $config->{'script'}
&& ref \$config->{'script'} eq 'SCALAR'
&& ref \( $config->{'script'} // \1 ) eq 'SCALAR'
&& length $config->{'script'}
&& -f $config->{'script'}
) {
Expand Down
1 change: 1 addition & 0 deletions incubator/RoundcubePlugins/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
'bayes_auto_learn_threshold_spam' => '12.0',
'use_bayes_rules' => '1'
],
'sauserprefs_abook_import' => false,
'sauserprefs_bayes_delete_query' => [
'DELETE FROM `bayes_seen` WHERE `id` IN (SELECT `id` FROM `bayes_vars` WHERE `username` = %u);',
'DELETE FROM `bayes_token` WHERE `id` IN (SELECT `id` FROM `bayes_vars` WHERE `username` = %u);',
Expand Down

0 comments on commit 78f10a0

Please sign in to comment.