Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
5 / 5
TranslateHooks
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
5 / 5
 onModifyMessageGroupStates
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
5 / 5
<?php
namespace FundraisingTranslateWorkflow;
/**
 * Modifies message group permissions when the group ID matches configuration.
 */
class TranslateHooks {
    /**
     * Translate:modifyMessageGroupStates hook handler
     *
     * @param string $groupId
     * @param array &$conf
     */
    public static function onModifyMessageGroupStates( $groupId, &$conf ) {
        global $wgFundraisingTranslateWorkflowPagePatterns,
            $wgFundraisingTranslateWorkflowPublishRight;
        foreach ( $wgFundraisingTranslateWorkflowPagePatterns as $pattern ) {
            if ( preg_match( $pattern, $groupId ) ) {
                $conf['published']['right'] = $wgFundraisingTranslateWorkflowPublishRight;
                break;
            }
        }
    }
}