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

PluginFilesbackendSeafile   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 44
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 3 1
A execute() 0 7 2
A onBeforeSettingsInit() 0 8 1
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