Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TranslateHooks
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 onModifyMessageGroupStates
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2namespace FundraisingTranslateWorkflow;
3
4/**
5 * Modifies message group permissions when the group ID matches configuration.
6 */
7class TranslateHooks {
8
9    /**
10     * Translate:modifyMessageGroupStates hook handler
11     *
12     * @param string $groupId
13     * @param array &$conf
14     */
15    public static function onModifyMessageGroupStates( $groupId, &$conf ) {
16        global $wgFundraisingTranslateWorkflowPagePatterns,
17            $wgFundraisingTranslateWorkflowPublishRight;
18
19        foreach ( $wgFundraisingTranslateWorkflowPagePatterns as $pattern ) {
20            if ( preg_match( $pattern, $groupId ) ) {
21                $conf['published']['right'] = $wgFundraisingTranslateWorkflowPublishRight;
22                break;
23            }
24        }
25    }
26}