From c86f38672a8fce11f19c3894d870d447d7d65de8 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 10 Feb 2026 23:21:55 +1100 Subject: [PATCH] Hide Sieve form section when managesieve plugin is not active Add GitHub Actions workflows for PHP CodeSniffer and PHP Lint (8.2/8.3/8.4). --- .github/workflows/php-lint.yml | 24 ++++++++++++++++++++++++ .github/workflows/phpcs.yml | 25 +++++++++++++++++++++++++ lib/IdentSwitchForm.php | 10 ++++++---- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/php-lint.yml create mode 100644 .github/workflows/phpcs.yml diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml new file mode 100644 index 0000000..6abcbf4 --- /dev/null +++ b/.github/workflows/php-lint.yml @@ -0,0 +1,24 @@ +name: PHP Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: ['8.2', '8.3', '8.4'] + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Lint PHP files + run: find . -name '*.php' -not -path './vendor/*' -exec php -l {} + | (! grep -v "No syntax errors") diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 0000000..6654846 --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,25 @@ +name: PHP CodeSniffer + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + phpcs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + tools: composer + + - name: Install dependencies + run: composer config allow-plugins.roundcube/plugin-installer true && composer install --prefer-dist --no-progress + + - name: Run PHP CodeSniffer + run: composer phpcs diff --git a/lib/IdentSwitchForm.php b/lib/IdentSwitchForm.php index 427d25d..4eef915 100644 --- a/lib/IdentSwitchForm.php +++ b/lib/IdentSwitchForm.php @@ -713,10 +713,12 @@ class IdentSwitchForm 'name' => $this->plugin->gettext('form.smtp.caption'), 'content' => $this->get_smtp_fields($record), ]; - $args['form']['ident_switch.sieve'] = [ - 'name' => $this->plugin->gettext('form.sieve.caption'), - 'content' => $this->get_sieve_fields($record), - ]; + if ($rc->plugins->get_plugin('managesieve')) { + $args['form']['ident_switch.sieve'] = [ + 'name' => $this->plugin->gettext('form.sieve.caption'), + 'content' => $this->get_sieve_fields($record), + ]; + } if (!$rc->config->get('ident_switch.check_mail', true)) { // Admin disabled background mail checking } elseif ($rc->plugins->get_plugin('newmail_notifier')) {