Passed
Push — master ( 37cafd...a8b392 )
by
unknown
07:18
created

PluginFilesbackendDefault   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A init() 0 3 1
A execute() 0 6 2
A onBeforeSettingsInit() 0 12 1
1
<?php
2
3
/**
4
 * Files Plugin - Default backend.
5
 *
6
 * This plugin provides the default WebDAV backend for Files.
7
 */
8
class PluginFilesbackendDefault extends Plugin
9
{
10
    /**
11
     * Constructor.
12
     */
13
    public function __construct()
14
    {
15
    }
16
17
    /**
18
     * Called to initialize the plugin and register for hooks.
19
     */
20
    public function init()
21
    {
22
        $this->registerHook('server.core.settings.init.before');
23
    }
24
25
    /**
26
     * Function is executed when a hook is triggered by the PluginManager.
27
     *
28
     * @param string $eventID Identifier of the hook
29
     * @param array  $data    Reference to the data of the triggered hook
30
     */
31
    public function execute($eventID, &$data)
32
    {
33
        switch ($eventID) {
34
            case 'server.core.settings.init.before':
35
                $this->onBeforeSettingsInit($data);
36
                break;
37
        }
38
    }
39
40
    /**
41
     * Called when the core Settings class is initialized and ready to accept sysadmin default
42
     * settings. Registers the sysadmin defaults for the files backend plugin.
43
     *
44
     * @param array $data Reference to the data of the triggered hook
45
     */
46
    public function onBeforeSettingsInit(&$data)
47
    {
48
        $data['settingsObj']->addSysAdminDefaults([
49
            'zarafa' => [
50
                'v1' => [
51
                    'plugins' => [
52
                        'filesbackendDefault' => [
53
                            'enable' => true,
54
                        ],
55
                        // Compatibility alias for pre-existing configurations
56
                        'filesbackendOwncloud' => [
57
                            'enable' => true,
58
                        ],
59
                    ],
60
                ],
61
            ],
62
        ]);
63
    }
64
}
65