@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $container = $this->getContainer(); |
65 | 65 | |
66 | 66 | // mapper |
67 | - $container->registerService('FileOperationMapper', function ($c) { |
|
67 | + $container->registerService('FileOperationMapper', function($c) { |
|
68 | 68 | return new FileOperationMapper( |
69 | 69 | $c->query('ServerContainer')->getDb() |
70 | 70 | ); |
71 | 71 | }); |
72 | 72 | |
73 | 73 | // services |
74 | - $container->registerService('FileOperationService', function ($c) { |
|
74 | + $container->registerService('FileOperationService', function($c) { |
|
75 | 75 | return new FileOperationService( |
76 | 76 | $c->query(FileOperationMapper::class), |
77 | 77 | $c->query('ServerContainer')->getUserSession()->getUser()->getUID() |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | }); |
80 | 80 | |
81 | 81 | // classifier |
82 | - $container->registerService('Classifier', function ($c) { |
|
82 | + $container->registerService('Classifier', function($c) { |
|
83 | 83 | return new Classifier( |
84 | 84 | $c->query(ILogger::class), |
85 | 85 | $c->query(FileOperationMapper::class), |
@@ -88,28 +88,28 @@ discard block |
||
88 | 88 | }); |
89 | 89 | |
90 | 90 | // entropy |
91 | - $container->registerService('Entropy', function ($c) { |
|
91 | + $container->registerService('Entropy', function($c) { |
|
92 | 92 | return new Entropy( |
93 | 93 | $c->query(ILogger::class) |
94 | 94 | ); |
95 | 95 | }); |
96 | 96 | |
97 | 97 | // analyzer |
98 | - $container->registerService('SequenceSizeAnalyzer', function ($c) { |
|
98 | + $container->registerService('SequenceSizeAnalyzer', function($c) { |
|
99 | 99 | return new SequenceSizeAnalyzer(); |
100 | 100 | }); |
101 | 101 | |
102 | - $container->registerService('FileTypeFunnellingAnalyzer', function ($c) { |
|
102 | + $container->registerService('FileTypeFunnellingAnalyzer', function($c) { |
|
103 | 103 | return new FileTypeFunnellingAnalyzer(); |
104 | 104 | }); |
105 | 105 | |
106 | - $container->registerService('EntropyFunnellingAnalyzer', function ($c) { |
|
106 | + $container->registerService('EntropyFunnellingAnalyzer', function($c) { |
|
107 | 107 | return new EntropyFunnellingAnalyzer( |
108 | 108 | $c->query(ILogger::class) |
109 | 109 | ); |
110 | 110 | }); |
111 | 111 | |
112 | - $container->registerService('FileExtensionAnalyzer', function ($c) { |
|
112 | + $container->registerService('FileExtensionAnalyzer', function($c) { |
|
113 | 113 | return new FileExtensionAnalyzer( |
114 | 114 | $c->query(ILogger::class), |
115 | 115 | $c->query(Entropy::class) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ); |
118 | 118 | }); |
119 | 119 | |
120 | - $container->registerService('SequenceAnalyzer', function ($c) { |
|
120 | + $container->registerService('SequenceAnalyzer', function($c) { |
|
121 | 121 | return new SequenceAnalyzer( |
122 | 122 | $c->query(SequenceSizeAnalyzer::class), |
123 | 123 | $c->query(FileTypeFunnellingAnalyzer::class), |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ); |
126 | 126 | }); |
127 | 127 | |
128 | - $container->registerService('EntropyAnalyzer', function ($c) { |
|
128 | + $container->registerService('EntropyAnalyzer', function($c) { |
|
129 | 129 | return new EntropyAnalyzer( |
130 | 130 | $c->query(ILogger::class), |
131 | 131 | $c->query(IRootFolder::class), |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ); |
135 | 135 | }); |
136 | 136 | |
137 | - $container->registerService('FileCorruptionAnalyzer', function ($c) { |
|
137 | + $container->registerService('FileCorruptionAnalyzer', function($c) { |
|
138 | 138 | return new FileCorruptionAnalyzer( |
139 | 139 | $c->query(ILogger::class), |
140 | 140 | $c->query(IRootFolder::class), |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ); |
143 | 143 | }); |
144 | 144 | |
145 | - $container->registerService('Monitor', function ($c) { |
|
145 | + $container->registerService('Monitor', function($c) { |
|
146 | 146 | return new Monitor( |
147 | 147 | $c->query(IRequest::class), |
148 | 148 | $c->query(IConfig::class), |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | ); |
159 | 159 | }); |
160 | 160 | |
161 | - $container->registerService('FilesEvents', function ($c) { |
|
161 | + $container->registerService('FilesEvents', function($c) { |
|
162 | 162 | return new FilesEvents( |
163 | 163 | $c->query(ILogger::class), |
164 | 164 | $c->query(Monitor::class), |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | // register sabre plugin to catch the profind requests |
176 | 176 | $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
177 | - $eventDispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $event) { |
|
177 | + $eventDispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function(SabrePluginEvent $event) { |
|
178 | 178 | $logger = $this->getContainer()->query(ILogger::class); |
179 | 179 | $config = $this->getContainer()->query(IConfig::class); |
180 | 180 | $userSession = $this->getContainer()->query(IUserSession::class); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | class FilesEvents { |
29 | 29 | |
30 | - /** @var string */ |
|
30 | + /** @var string */ |
|
31 | 31 | private $userId; |
32 | 32 | |
33 | 33 | /** @var ILogger */ |
@@ -37,74 +37,74 @@ discard block |
||
37 | 37 | private $monitor; |
38 | 38 | |
39 | 39 | |
40 | - /** |
|
40 | + /** |
|
41 | 41 | * @param ILogger $logger |
42 | 42 | * @param Monitor $monitor |
43 | - * @param string $userId |
|
44 | - */ |
|
45 | - public function __construct( |
|
43 | + * @param string $userId |
|
44 | + */ |
|
45 | + public function __construct( |
|
46 | 46 | ILogger $logger, |
47 | 47 | Monitor $monitor, |
48 | 48 | $userId |
49 | 49 | |
50 | - ) { |
|
50 | + ) { |
|
51 | 51 | $this->logger = $logger; |
52 | 52 | $this->monitor = $monitor; |
53 | - $this->userId = $userId; |
|
54 | - } |
|
53 | + $this->userId = $userId; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param array $params |
|
58 | - */ |
|
59 | - public function onFileUpdate(array $params) { |
|
56 | + /** |
|
57 | + * @param array $params |
|
58 | + */ |
|
59 | + public function onFileUpdate(array $params) { |
|
60 | 60 | $this->logger->debug("Updating ".$params['path'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
61 | 61 | $this->analyze([$params['path']], Monitor::WRITE); |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * @param array $params |
|
67 | - */ |
|
68 | - public function onFileRename(array $params) { |
|
65 | + /** |
|
66 | + * @param array $params |
|
67 | + */ |
|
68 | + public function onFileRename(array $params) { |
|
69 | 69 | $this->logger->debug("Renaming ".$params['oldpath']." to ".$params['newpath'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
70 | 70 | $this->analyze([$params['oldpath'], $params['newpath']], Monitor::RENAME); |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | - * @param array $params |
|
75 | - */ |
|
74 | + * @param array $params |
|
75 | + */ |
|
76 | 76 | public function onFileCreate(array $params) { |
77 | 77 | $this->logger->debug("Creating ".$params['path'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
78 | 78 | $this->analyze([$params['path']], Monitor::CREATE); |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | - * @param array $params |
|
83 | - */ |
|
82 | + * @param array $params |
|
83 | + */ |
|
84 | 84 | public function onFileWrite(array $params) { |
85 | 85 | $this->logger->debug("Writing ".$params['path'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
86 | 86 | $this->analyze([$params['path']], Monitor::WRITE); |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @param array $params |
|
91 | - */ |
|
90 | + * @param array $params |
|
91 | + */ |
|
92 | 92 | public function onFileDelete(array $params) { |
93 | 93 | $this->logger->debug("Deleting ".$params['path'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
94 | 94 | $this->analyze([$params['path']], Monitor::DELETE); |
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | - * @param array $params |
|
99 | - */ |
|
98 | + * @param array $params |
|
99 | + */ |
|
100 | 100 | public function onFileCopy(array $params) { |
101 | 101 | $this->logger->debug("Copying ".$params['oldpath']." to ".$params['newpath'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
102 | 102 | $this->analyze([$params['oldpath'], $params['newpath']], Monitor::RENAME); |
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | - * @param array $params |
|
107 | - */ |
|
106 | + * @param array $params |
|
107 | + */ |
|
108 | 108 | public function onFileTouch(array $params) { |
109 | 109 | $this->logger->debug("Touching ".$params['path'].": Params: ".print_r($params, true), ['app' => Application::APP_ID]); |
110 | 110 | $this->analyze([$params['path']], Monitor::WRITE); |
@@ -26,86 +26,86 @@ |
||
26 | 26 | |
27 | 27 | class FilesHooks { |
28 | 28 | |
29 | - /** |
|
30 | - * Retrieve the FilesEvents' Controller. |
|
31 | - * |
|
32 | - * @return FilesEvents |
|
33 | - */ |
|
34 | - protected static function getController(): FilesEvents { |
|
35 | - $app = new Application(); |
|
29 | + /** |
|
30 | + * Retrieve the FilesEvents' Controller. |
|
31 | + * |
|
32 | + * @return FilesEvents |
|
33 | + */ |
|
34 | + protected static function getController(): FilesEvents { |
|
35 | + $app = new Application(); |
|
36 | 36 | |
37 | - return $app->getContainer() |
|
38 | - ->query(FilesEvents::class); |
|
39 | - } |
|
37 | + return $app->getContainer() |
|
38 | + ->query(FilesEvents::class); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Hook events: file is updated. |
|
43 | - * |
|
44 | - * @param array $params |
|
45 | - */ |
|
46 | - public static function onFileUpdate(array $params) { |
|
47 | - self::getController() |
|
48 | - ->onFileUpdate($params); |
|
49 | - } |
|
41 | + /** |
|
42 | + * Hook events: file is updated. |
|
43 | + * |
|
44 | + * @param array $params |
|
45 | + */ |
|
46 | + public static function onFileUpdate(array $params) { |
|
47 | + self::getController() |
|
48 | + ->onFileUpdate($params); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Hook events: file is renamed. |
|
54 | - * |
|
55 | - * @param array $params |
|
56 | - */ |
|
57 | - public static function onFileRename(array $params) { |
|
58 | - self::getController() |
|
59 | - ->onFileRename($params); |
|
52 | + /** |
|
53 | + * Hook events: file is renamed. |
|
54 | + * |
|
55 | + * @param array $params |
|
56 | + */ |
|
57 | + public static function onFileRename(array $params) { |
|
58 | + self::getController() |
|
59 | + ->onFileRename($params); |
|
60 | 60 | } |
61 | 61 | |
62 | - /** |
|
63 | - * Hook events: file is created. |
|
64 | - * |
|
65 | - * @param array $params |
|
66 | - */ |
|
62 | + /** |
|
63 | + * Hook events: file is created. |
|
64 | + * |
|
65 | + * @param array $params |
|
66 | + */ |
|
67 | 67 | public static function onFileCreate(array $params) { |
68 | - self::getController() |
|
69 | - ->onFileCreate($params); |
|
68 | + self::getController() |
|
69 | + ->onFileCreate($params); |
|
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Hook events: file is written. |
|
74 | - * |
|
75 | - * @param array $params |
|
76 | - */ |
|
72 | + /** |
|
73 | + * Hook events: file is written. |
|
74 | + * |
|
75 | + * @param array $params |
|
76 | + */ |
|
77 | 77 | public static function onFileWrite(array $params) { |
78 | - self::getController() |
|
79 | - ->onFileWrite($params); |
|
78 | + self::getController() |
|
79 | + ->onFileWrite($params); |
|
80 | 80 | } |
81 | 81 | |
82 | - /** |
|
83 | - * Hook events: file is deleted. |
|
84 | - * |
|
85 | - * @param array $params |
|
86 | - */ |
|
82 | + /** |
|
83 | + * Hook events: file is deleted. |
|
84 | + * |
|
85 | + * @param array $params |
|
86 | + */ |
|
87 | 87 | public static function onFileDelete(array $params) { |
88 | - self::getController() |
|
89 | - ->onFileDelete($params); |
|
88 | + self::getController() |
|
89 | + ->onFileDelete($params); |
|
90 | 90 | } |
91 | 91 | |
92 | - /** |
|
93 | - * Hook events: file is touched. |
|
94 | - * |
|
95 | - * @param array $params |
|
96 | - */ |
|
92 | + /** |
|
93 | + * Hook events: file is touched. |
|
94 | + * |
|
95 | + * @param array $params |
|
96 | + */ |
|
97 | 97 | public static function onFileTouch(array $params) { |
98 | - self::getController() |
|
99 | - ->onFileTouch($params); |
|
98 | + self::getController() |
|
99 | + ->onFileTouch($params); |
|
100 | 100 | } |
101 | 101 | |
102 | - /** |
|
103 | - * Hook events: file is copied. |
|
104 | - * |
|
105 | - * @param array $params |
|
106 | - */ |
|
102 | + /** |
|
103 | + * Hook events: file is copied. |
|
104 | + * |
|
105 | + * @param array $params |
|
106 | + */ |
|
107 | 107 | public static function onFileCopy(array $params) { |
108 | - self::getController() |
|
109 | - ->onFileCopy($params); |
|
110 | - } |
|
108 | + self::getController() |
|
109 | + ->onFileCopy($params); |
|
110 | + } |
|
111 | 111 | } |
112 | 112 | \ No newline at end of file |