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

PluginFilesbackendSeafile::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 7
rs 10
1
<?php declare(strict_types=1);
2
3
/**
4
 * Files Plugin - Seafile backend
5
 *
6
 * This plugin provides the backend for Seafile.
7
 */
8
final class PluginFilesbackendSeafile extends Plugin
9
{
10
11
    /**
12
	 * Called to initialize the plugin and register for hooks.
13
	 *
14
	 * @return void
15
	 */
16
	public function init()
17
	{
18
		$this->registerHook('server.core.settings.init.before');
19
	}
20
21
	/**
22
	 * Function is executed when a hook is triggered by the PluginManager
23
	 *
24
	 * @param String $eventID Identifier of the hook
25
	 * @param Array $data Reference to the data of the triggered hook
26
	 */
27
	public function execute($eventID, &$data)
28
	{
29
		switch ($eventID) {
30
			case 'server.core.settings.init.before':
31
				$this->onBeforeSettingsInit($data);
32
				break;
33
            default:
34
		}
35
	}
36
37
	/**
38
	 * Called when the core Settings class is initialized and ready to accept sysadmin default
39
	 * settings. Registers the sysadmin defaults for the filesbackendSeafile plugin.
40
	 *
41
	 * @param Array $data Reference to the data of the triggered hook
42
	 * @return void
43
	 */
44
	public function onBeforeSettingsInit(&$data)
45
	{
46
		$data['settingsObj']->addSysAdminDefaults(array(
47
			'zarafa' => array(
48
				'v1' => array(
49
					'plugins' => array(
50
						'filesbackendSeafile' => array(
51
							'enable' => true,
52
						)
53
					)
54
				)
55
			)
56
		));
57
	}
58
}
59