@@ -38,71 +38,71 @@ |
||
38 | 38 | */ |
39 | 39 | class GroupManagement extends Action { |
40 | 40 | |
41 | - /** |
|
42 | - * log add user to group event |
|
43 | - * |
|
44 | - * @param IGroup $group |
|
45 | - * @param IUser $user |
|
46 | - */ |
|
47 | - public function addUser(IGroup $group, IUser $user) { |
|
48 | - $this->log('User "%s" added to group "%s"', |
|
49 | - [ |
|
50 | - 'group' => $group->getGID(), |
|
51 | - 'user' => $user->getUID() |
|
52 | - ], |
|
53 | - [ |
|
54 | - 'user', 'group' |
|
55 | - ] |
|
56 | - ); |
|
57 | - } |
|
41 | + /** |
|
42 | + * log add user to group event |
|
43 | + * |
|
44 | + * @param IGroup $group |
|
45 | + * @param IUser $user |
|
46 | + */ |
|
47 | + public function addUser(IGroup $group, IUser $user) { |
|
48 | + $this->log('User "%s" added to group "%s"', |
|
49 | + [ |
|
50 | + 'group' => $group->getGID(), |
|
51 | + 'user' => $user->getUID() |
|
52 | + ], |
|
53 | + [ |
|
54 | + 'user', 'group' |
|
55 | + ] |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * log remove user from group event |
|
61 | - * |
|
62 | - * @param IGroup $group |
|
63 | - * @param IUser $user |
|
64 | - */ |
|
65 | - public function removeUser(IGroup $group, IUser $user) { |
|
66 | - $this->log('User "%s" removed from group "%s"', |
|
67 | - [ |
|
68 | - 'group' => $group->getGID(), |
|
69 | - 'user' => $user->getUID() |
|
70 | - ], |
|
71 | - [ |
|
72 | - 'user', 'group' |
|
73 | - ] |
|
74 | - ); |
|
75 | - } |
|
59 | + /** |
|
60 | + * log remove user from group event |
|
61 | + * |
|
62 | + * @param IGroup $group |
|
63 | + * @param IUser $user |
|
64 | + */ |
|
65 | + public function removeUser(IGroup $group, IUser $user) { |
|
66 | + $this->log('User "%s" removed from group "%s"', |
|
67 | + [ |
|
68 | + 'group' => $group->getGID(), |
|
69 | + 'user' => $user->getUID() |
|
70 | + ], |
|
71 | + [ |
|
72 | + 'user', 'group' |
|
73 | + ] |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * log create group to group event |
|
79 | - * |
|
80 | - * @param IGroup $group |
|
81 | - */ |
|
82 | - public function createGroup(IGroup $group) { |
|
83 | - $this->log('Group created: "%s"', |
|
84 | - [ |
|
85 | - 'group' => $group->getGID() |
|
86 | - ], |
|
87 | - [ |
|
88 | - 'group' |
|
89 | - ] |
|
90 | - ); |
|
91 | - } |
|
77 | + /** |
|
78 | + * log create group to group event |
|
79 | + * |
|
80 | + * @param IGroup $group |
|
81 | + */ |
|
82 | + public function createGroup(IGroup $group) { |
|
83 | + $this->log('Group created: "%s"', |
|
84 | + [ |
|
85 | + 'group' => $group->getGID() |
|
86 | + ], |
|
87 | + [ |
|
88 | + 'group' |
|
89 | + ] |
|
90 | + ); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * log delete group to group event |
|
95 | - * |
|
96 | - * @param IGroup $group |
|
97 | - */ |
|
98 | - public function deleteGroup(IGroup $group) { |
|
99 | - $this->log('Group deleted: "%s"', |
|
100 | - [ |
|
101 | - 'group' => $group->getGID() |
|
102 | - ], |
|
103 | - [ |
|
104 | - 'group' |
|
105 | - ] |
|
106 | - ); |
|
107 | - } |
|
93 | + /** |
|
94 | + * log delete group to group event |
|
95 | + * |
|
96 | + * @param IGroup $group |
|
97 | + */ |
|
98 | + public function deleteGroup(IGroup $group) { |
|
99 | + $this->log('Group deleted: "%s"', |
|
100 | + [ |
|
101 | + 'group' => $group->getGID() |
|
102 | + ], |
|
103 | + [ |
|
104 | + 'group' |
|
105 | + ] |
|
106 | + ); |
|
107 | + } |
|
108 | 108 | } |
@@ -29,137 +29,137 @@ |
||
29 | 29 | * @package OCA\AdminAudit\Actions |
30 | 30 | */ |
31 | 31 | class Files extends Action { |
32 | - /** |
|
33 | - * Logs file read actions |
|
34 | - * |
|
35 | - * @param array $params |
|
36 | - */ |
|
37 | - public function read(array $params) { |
|
38 | - $this->log( |
|
39 | - 'File accessed: "%s"', |
|
40 | - $params, |
|
41 | - [ |
|
42 | - 'path', |
|
43 | - ] |
|
44 | - ); |
|
45 | - } |
|
32 | + /** |
|
33 | + * Logs file read actions |
|
34 | + * |
|
35 | + * @param array $params |
|
36 | + */ |
|
37 | + public function read(array $params) { |
|
38 | + $this->log( |
|
39 | + 'File accessed: "%s"', |
|
40 | + $params, |
|
41 | + [ |
|
42 | + 'path', |
|
43 | + ] |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Logs rename actions of files |
|
49 | - * |
|
50 | - * @param array $params |
|
51 | - */ |
|
52 | - public function rename(array $params) { |
|
53 | - $this->log( |
|
54 | - 'File renamed: "%s" to "%s"', |
|
55 | - $params, |
|
56 | - [ |
|
57 | - 'oldpath', |
|
58 | - 'newpath', |
|
59 | - ] |
|
60 | - ); |
|
61 | - } |
|
47 | + /** |
|
48 | + * Logs rename actions of files |
|
49 | + * |
|
50 | + * @param array $params |
|
51 | + */ |
|
52 | + public function rename(array $params) { |
|
53 | + $this->log( |
|
54 | + 'File renamed: "%s" to "%s"', |
|
55 | + $params, |
|
56 | + [ |
|
57 | + 'oldpath', |
|
58 | + 'newpath', |
|
59 | + ] |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Logs creation of files |
|
65 | - * |
|
66 | - * @param array $params |
|
67 | - */ |
|
68 | - public function create(array $params) { |
|
69 | - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
70 | - return; |
|
71 | - } |
|
63 | + /** |
|
64 | + * Logs creation of files |
|
65 | + * |
|
66 | + * @param array $params |
|
67 | + */ |
|
68 | + public function create(array $params) { |
|
69 | + if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
70 | + return; |
|
71 | + } |
|
72 | 72 | |
73 | - $this->log( |
|
74 | - 'File created: "%s"', |
|
75 | - $params, |
|
76 | - [ |
|
77 | - 'path', |
|
78 | - ] |
|
79 | - ); |
|
80 | - } |
|
73 | + $this->log( |
|
74 | + 'File created: "%s"', |
|
75 | + $params, |
|
76 | + [ |
|
77 | + 'path', |
|
78 | + ] |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Logs copying of files |
|
84 | - * |
|
85 | - * @param array $params |
|
86 | - */ |
|
87 | - public function copy(array $params) { |
|
88 | - $this->log( |
|
89 | - 'File copied: "%s" to "%s"', |
|
90 | - $params, |
|
91 | - [ |
|
92 | - 'oldpath', |
|
93 | - 'newpath', |
|
94 | - ] |
|
95 | - ); |
|
96 | - } |
|
82 | + /** |
|
83 | + * Logs copying of files |
|
84 | + * |
|
85 | + * @param array $params |
|
86 | + */ |
|
87 | + public function copy(array $params) { |
|
88 | + $this->log( |
|
89 | + 'File copied: "%s" to "%s"', |
|
90 | + $params, |
|
91 | + [ |
|
92 | + 'oldpath', |
|
93 | + 'newpath', |
|
94 | + ] |
|
95 | + ); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Logs writing of files |
|
100 | - * |
|
101 | - * @param array $params |
|
102 | - */ |
|
103 | - public function write(array $params) { |
|
104 | - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
105 | - return; |
|
106 | - } |
|
98 | + /** |
|
99 | + * Logs writing of files |
|
100 | + * |
|
101 | + * @param array $params |
|
102 | + */ |
|
103 | + public function write(array $params) { |
|
104 | + if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { |
|
105 | + return; |
|
106 | + } |
|
107 | 107 | |
108 | - $this->log( |
|
109 | - 'File written to: "%s"', |
|
110 | - $params, |
|
111 | - [ |
|
112 | - 'path', |
|
113 | - ] |
|
114 | - ); |
|
115 | - } |
|
108 | + $this->log( |
|
109 | + 'File written to: "%s"', |
|
110 | + $params, |
|
111 | + [ |
|
112 | + 'path', |
|
113 | + ] |
|
114 | + ); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Logs update of files |
|
119 | - * |
|
120 | - * @param array $params |
|
121 | - */ |
|
122 | - public function update(array $params) { |
|
123 | - $this->log( |
|
124 | - 'File updated: "%s"', |
|
125 | - $params, |
|
126 | - [ |
|
127 | - 'path', |
|
128 | - ] |
|
129 | - ); |
|
130 | - } |
|
117 | + /** |
|
118 | + * Logs update of files |
|
119 | + * |
|
120 | + * @param array $params |
|
121 | + */ |
|
122 | + public function update(array $params) { |
|
123 | + $this->log( |
|
124 | + 'File updated: "%s"', |
|
125 | + $params, |
|
126 | + [ |
|
127 | + 'path', |
|
128 | + ] |
|
129 | + ); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Logs deletions of files |
|
134 | - * |
|
135 | - * @param array $params |
|
136 | - */ |
|
137 | - public function delete(array $params) { |
|
138 | - $this->log( |
|
139 | - 'File deleted: "%s"', |
|
140 | - $params, |
|
141 | - [ |
|
142 | - 'path', |
|
143 | - ] |
|
144 | - ); |
|
145 | - } |
|
132 | + /** |
|
133 | + * Logs deletions of files |
|
134 | + * |
|
135 | + * @param array $params |
|
136 | + */ |
|
137 | + public function delete(array $params) { |
|
138 | + $this->log( |
|
139 | + 'File deleted: "%s"', |
|
140 | + $params, |
|
141 | + [ |
|
142 | + 'path', |
|
143 | + ] |
|
144 | + ); |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * Logs preview access to a file |
|
149 | - * |
|
150 | - * @param array $params |
|
151 | - */ |
|
152 | - public function preview(array $params) { |
|
153 | - $this->log( |
|
154 | - 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', |
|
155 | - $params, |
|
156 | - [ |
|
157 | - 'path', |
|
158 | - 'width', |
|
159 | - 'height', |
|
160 | - 'crop', |
|
161 | - 'mode' |
|
162 | - ] |
|
163 | - ); |
|
164 | - } |
|
147 | + /** |
|
148 | + * Logs preview access to a file |
|
149 | + * |
|
150 | + * @param array $params |
|
151 | + */ |
|
152 | + public function preview(array $params) { |
|
153 | + $this->log( |
|
154 | + 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', |
|
155 | + $params, |
|
156 | + [ |
|
157 | + 'path', |
|
158 | + 'width', |
|
159 | + 'height', |
|
160 | + 'crop', |
|
161 | + 'mode' |
|
162 | + ] |
|
163 | + ); |
|
164 | + } |
|
165 | 165 | } |
@@ -29,33 +29,33 @@ |
||
29 | 29 | * @package OCA\AdminAudit\Actions |
30 | 30 | */ |
31 | 31 | class Auth extends Action { |
32 | - public function loginAttempt(array $params) { |
|
33 | - $this->log( |
|
34 | - 'Login attempt: "%s"', |
|
35 | - $params, |
|
36 | - [ |
|
37 | - 'uid', |
|
38 | - ], |
|
39 | - true |
|
40 | - ); |
|
41 | - } |
|
32 | + public function loginAttempt(array $params) { |
|
33 | + $this->log( |
|
34 | + 'Login attempt: "%s"', |
|
35 | + $params, |
|
36 | + [ |
|
37 | + 'uid', |
|
38 | + ], |
|
39 | + true |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - public function loginSuccessful(array $params) { |
|
44 | - $this->log( |
|
45 | - 'Login successful: "%s"', |
|
46 | - $params, |
|
47 | - [ |
|
48 | - 'uid', |
|
49 | - ], |
|
50 | - true |
|
51 | - ); |
|
52 | - } |
|
43 | + public function loginSuccessful(array $params) { |
|
44 | + $this->log( |
|
45 | + 'Login successful: "%s"', |
|
46 | + $params, |
|
47 | + [ |
|
48 | + 'uid', |
|
49 | + ], |
|
50 | + true |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | - public function logout(array $params) { |
|
55 | - $this->log( |
|
56 | - 'Logout occurred', |
|
57 | - [], |
|
58 | - [] |
|
59 | - ); |
|
60 | - } |
|
54 | + public function logout(array $params) { |
|
55 | + $this->log( |
|
56 | + 'Logout occurred', |
|
57 | + [], |
|
58 | + [] |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | } |
@@ -29,25 +29,25 @@ |
||
29 | 29 | use OCP\IUserSession; |
30 | 30 | |
31 | 31 | class PersonalSection extends Section { |
32 | - /** @var IUserSession */ |
|
33 | - private $userSession; |
|
32 | + /** @var IUserSession */ |
|
33 | + private $userSession; |
|
34 | 34 | |
35 | - /** @var UserGlobalStoragesService */ |
|
36 | - private $userGlobalStoragesService; |
|
35 | + /** @var UserGlobalStoragesService */ |
|
36 | + private $userGlobalStoragesService; |
|
37 | 37 | |
38 | - /** @var BackendService */ |
|
39 | - private $backendService; |
|
38 | + /** @var BackendService */ |
|
39 | + private $backendService; |
|
40 | 40 | |
41 | - public function __construct( |
|
42 | - IURLGenerator $url, |
|
43 | - IL10N $l, |
|
44 | - IUserSession $userSession, |
|
45 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | - BackendService $backendService |
|
47 | - ) { |
|
48 | - parent::__construct($url, $l); |
|
49 | - $this->userSession = $userSession; |
|
50 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | - $this->backendService = $backendService; |
|
52 | - } |
|
41 | + public function __construct( |
|
42 | + IURLGenerator $url, |
|
43 | + IL10N $l, |
|
44 | + IUserSession $userSession, |
|
45 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
46 | + BackendService $backendService |
|
47 | + ) { |
|
48 | + parent::__construct($url, $l); |
|
49 | + $this->userSession = $userSession; |
|
50 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
51 | + $this->backendService = $backendService; |
|
52 | + } |
|
53 | 53 | } |
@@ -26,19 +26,19 @@ |
||
26 | 26 | use OC\Files\Storage\Wrapper\Jail; |
27 | 27 | |
28 | 28 | class JailPropagator extends Propagator { |
29 | - /** |
|
30 | - * @var Jail |
|
31 | - */ |
|
32 | - protected $storage; |
|
29 | + /** |
|
30 | + * @var Jail |
|
31 | + */ |
|
32 | + protected $storage; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param string $internalPath |
|
36 | - * @param int $time |
|
37 | - * @param int $sizeDifference |
|
38 | - */ |
|
39 | - public function propagateChange($internalPath, $time, $sizeDifference = 0) { |
|
40 | - /** @var \OC\Files\Storage\Storage $storage */ |
|
41 | - list($storage, $sourceInternalPath) = $this->storage->resolvePath($internalPath); |
|
42 | - $storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference); |
|
43 | - } |
|
34 | + /** |
|
35 | + * @param string $internalPath |
|
36 | + * @param int $time |
|
37 | + * @param int $sizeDifference |
|
38 | + */ |
|
39 | + public function propagateChange($internalPath, $time, $sizeDifference = 0) { |
|
40 | + /** @var \OC\Files\Storage\Storage $storage */ |
|
41 | + list($storage, $sourceInternalPath) = $this->storage->resolvePath($internalPath); |
|
42 | + $storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference); |
|
43 | + } |
|
44 | 44 | } |
@@ -24,29 +24,29 @@ |
||
24 | 24 | use OCP\IRequest; |
25 | 25 | |
26 | 26 | class Capabilities implements IPublicCapability { |
27 | - /** @var IRequest */ |
|
28 | - private $request; |
|
27 | + /** @var IRequest */ |
|
28 | + private $request; |
|
29 | 29 | |
30 | - /** @var Throttler */ |
|
31 | - private $throttler; |
|
30 | + /** @var Throttler */ |
|
31 | + private $throttler; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Capabilities constructor. |
|
35 | - * |
|
36 | - * @param IRequest $request |
|
37 | - * @param Throttler $throttler |
|
38 | - */ |
|
39 | - public function __construct(IRequest $request, |
|
40 | - Throttler $throttler) { |
|
41 | - $this->request = $request; |
|
42 | - $this->throttler = $throttler; |
|
43 | - } |
|
33 | + /** |
|
34 | + * Capabilities constructor. |
|
35 | + * |
|
36 | + * @param IRequest $request |
|
37 | + * @param Throttler $throttler |
|
38 | + */ |
|
39 | + public function __construct(IRequest $request, |
|
40 | + Throttler $throttler) { |
|
41 | + $this->request = $request; |
|
42 | + $this->throttler = $throttler; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getCapabilities() { |
|
46 | - return [ |
|
47 | - 'bruteforce' => [ |
|
48 | - 'delay' => $this->throttler->getDelay($this->request->getRemoteAddress()) |
|
49 | - ] |
|
50 | - ]; |
|
51 | - } |
|
45 | + public function getCapabilities() { |
|
46 | + return [ |
|
47 | + 'bruteforce' => [ |
|
48 | + 'delay' => $this->throttler->getDelay($this->request->getRemoteAddress()) |
|
49 | + ] |
|
50 | + ]; |
|
51 | + } |
|
52 | 52 | } |
@@ -29,68 +29,68 @@ |
||
29 | 29 | use OCP\Diagnostics\IQueryLogger; |
30 | 30 | |
31 | 31 | class QueryLogger implements IQueryLogger { |
32 | - /** |
|
33 | - * @var \OC\Diagnostics\Query |
|
34 | - */ |
|
35 | - protected $activeQuery; |
|
32 | + /** |
|
33 | + * @var \OC\Diagnostics\Query |
|
34 | + */ |
|
35 | + protected $activeQuery; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var CappedMemoryCache |
|
39 | - */ |
|
40 | - protected $queries; |
|
37 | + /** |
|
38 | + * @var CappedMemoryCache |
|
39 | + */ |
|
40 | + protected $queries; |
|
41 | 41 | |
42 | - /** |
|
43 | - * QueryLogger constructor. |
|
44 | - */ |
|
45 | - public function __construct() { |
|
46 | - $this->queries = new CappedMemoryCache(1024); |
|
47 | - } |
|
42 | + /** |
|
43 | + * QueryLogger constructor. |
|
44 | + */ |
|
45 | + public function __construct() { |
|
46 | + $this->queries = new CappedMemoryCache(1024); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @var bool - Module needs to be activated by some app |
|
52 | - */ |
|
53 | - private $activated = false; |
|
50 | + /** |
|
51 | + * @var bool - Module needs to be activated by some app |
|
52 | + */ |
|
53 | + private $activated = false; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @inheritdoc |
|
57 | - */ |
|
58 | - public function startQuery($sql, array $params = null, array $types = null) { |
|
59 | - if ($this->activated) { |
|
60 | - $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); |
|
61 | - } |
|
62 | - } |
|
55 | + /** |
|
56 | + * @inheritdoc |
|
57 | + */ |
|
58 | + public function startQuery($sql, array $params = null, array $types = null) { |
|
59 | + if ($this->activated) { |
|
60 | + $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack()); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - private function getStack() { |
|
65 | - $stack = debug_backtrace(); |
|
66 | - array_shift($stack); |
|
67 | - array_shift($stack); |
|
68 | - array_shift($stack); |
|
69 | - return $stack; |
|
70 | - } |
|
64 | + private function getStack() { |
|
65 | + $stack = debug_backtrace(); |
|
66 | + array_shift($stack); |
|
67 | + array_shift($stack); |
|
68 | + array_shift($stack); |
|
69 | + return $stack; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @inheritdoc |
|
74 | - */ |
|
75 | - public function stopQuery() { |
|
76 | - if ($this->activated && $this->activeQuery) { |
|
77 | - $this->activeQuery->end(microtime(true)); |
|
78 | - $this->queries[] = $this->activeQuery; |
|
79 | - $this->activeQuery = null; |
|
80 | - } |
|
81 | - } |
|
72 | + /** |
|
73 | + * @inheritdoc |
|
74 | + */ |
|
75 | + public function stopQuery() { |
|
76 | + if ($this->activated && $this->activeQuery) { |
|
77 | + $this->activeQuery->end(microtime(true)); |
|
78 | + $this->queries[] = $this->activeQuery; |
|
79 | + $this->activeQuery = null; |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @inheritdoc |
|
85 | - */ |
|
86 | - public function getQueries() { |
|
87 | - return $this->queries->getData(); |
|
88 | - } |
|
83 | + /** |
|
84 | + * @inheritdoc |
|
85 | + */ |
|
86 | + public function getQueries() { |
|
87 | + return $this->queries->getData(); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @inheritdoc |
|
92 | - */ |
|
93 | - public function activate() { |
|
94 | - $this->activated = true; |
|
95 | - } |
|
90 | + /** |
|
91 | + * @inheritdoc |
|
92 | + */ |
|
93 | + public function activate() { |
|
94 | + $this->activated = true; |
|
95 | + } |
|
96 | 96 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | $appName = $input->getArgument('app'); |
61 | 61 | $version = $input->getArgument('version'); |
62 | 62 | |
63 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
63 | + if (!preg_match('/^\d{1,16}$/', $version)) { |
|
64 | 64 | $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
65 | 65 | return 1; |
66 | 66 | } |
67 | 67 | |
68 | - $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
68 | + $schemaFile = $this->appManager->getAppPath($appName).'/appinfo/database.xml'; |
|
69 | 69 | if (!file_exists($schemaFile)) { |
70 | - $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
70 | + $output->writeln('<error>App '.$appName.' does not have a database.xml file</error>'); |
|
71 | 71 | return 2; |
72 | 72 | } |
73 | 73 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
81 | 81 | |
82 | 82 | $date = date('YmdHis'); |
83 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
83 | + $path = $this->generateMigration($ms, 'Version'.$version.'Date'.$date, $schemaBody); |
|
84 | 84 | |
85 | 85 | $output->writeln("New migration class has been generated to <info>$path</info>"); |
86 | 86 | return 0; |
@@ -36,170 +36,170 @@ |
||
36 | 36 | |
37 | 37 | class GenerateFromSchemaFileCommand extends GenerateCommand { |
38 | 38 | |
39 | - /** @var IConfig */ |
|
40 | - protected $config; |
|
39 | + /** @var IConfig */ |
|
40 | + protected $config; |
|
41 | 41 | |
42 | - public function __construct(IConfig $config, IAppManager $appManager, IDBConnection $connection) { |
|
43 | - parent::__construct($connection, $appManager); |
|
44 | - $this->config = $config; |
|
45 | - } |
|
42 | + public function __construct(IConfig $config, IAppManager $appManager, IDBConnection $connection) { |
|
43 | + parent::__construct($connection, $appManager); |
|
44 | + $this->config = $config; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - protected function configure() { |
|
49 | - parent::configure(); |
|
48 | + protected function configure() { |
|
49 | + parent::configure(); |
|
50 | 50 | |
51 | - $this->setName('migrations:generate-from-schema'); |
|
52 | - } |
|
51 | + $this->setName('migrations:generate-from-schema'); |
|
52 | + } |
|
53 | 53 | |
54 | - public function execute(InputInterface $input, OutputInterface $output) { |
|
55 | - $appName = $input->getArgument('app'); |
|
56 | - $version = $input->getArgument('version'); |
|
54 | + public function execute(InputInterface $input, OutputInterface $output) { |
|
55 | + $appName = $input->getArgument('app'); |
|
56 | + $version = $input->getArgument('version'); |
|
57 | 57 | |
58 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
59 | - $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
|
60 | - return 1; |
|
61 | - } |
|
58 | + if (!preg_match('/^\d{1,16}$/',$version)) { |
|
59 | + $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
|
60 | + return 1; |
|
61 | + } |
|
62 | 62 | |
63 | - $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
64 | - if (!file_exists($schemaFile)) { |
|
65 | - $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
66 | - return 2; |
|
67 | - } |
|
63 | + $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
64 | + if (!file_exists($schemaFile)) { |
|
65 | + $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
66 | + return 2; |
|
67 | + } |
|
68 | 68 | |
69 | - $reader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); |
|
70 | - $schema = new Schema(); |
|
71 | - $reader->loadSchemaFromFile($schemaFile, $schema); |
|
69 | + $reader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); |
|
70 | + $schema = new Schema(); |
|
71 | + $reader->loadSchemaFromFile($schemaFile, $schema); |
|
72 | 72 | |
73 | - $schemaBody = $this->schemaToMigration($schema); |
|
73 | + $schemaBody = $this->schemaToMigration($schema); |
|
74 | 74 | |
75 | - $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
75 | + $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
76 | 76 | |
77 | - $date = date('YmdHis'); |
|
78 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
77 | + $date = date('YmdHis'); |
|
78 | + $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
79 | 79 | |
80 | - $output->writeln("New migration class has been generated to <info>$path</info>"); |
|
81 | - return 0; |
|
82 | - } |
|
80 | + $output->writeln("New migration class has been generated to <info>$path</info>"); |
|
81 | + return 0; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @param Schema $schema |
|
86 | - * @return string |
|
87 | - */ |
|
88 | - protected function schemaToMigration(Schema $schema) { |
|
89 | - $content = <<<'EOT' |
|
84 | + /** |
|
85 | + * @param Schema $schema |
|
86 | + * @return string |
|
87 | + */ |
|
88 | + protected function schemaToMigration(Schema $schema) { |
|
89 | + $content = <<<'EOT' |
|
90 | 90 | /** @var ISchemaWrapper $schema */ |
91 | 91 | $schema = $schemaClosure(); |
92 | 92 | |
93 | 93 | EOT; |
94 | 94 | |
95 | - foreach ($schema->getTables() as $table) { |
|
96 | - $content .= str_replace('{{table-name}}', substr($table->getName(), 3), <<<'EOT' |
|
95 | + foreach ($schema->getTables() as $table) { |
|
96 | + $content .= str_replace('{{table-name}}', substr($table->getName(), 3), <<<'EOT' |
|
97 | 97 | |
98 | 98 | if (!$schema->hasTable('{{table-name}}')) { |
99 | 99 | $table = $schema->createTable('{{table-name}}'); |
100 | 100 | |
101 | 101 | EOT |
102 | - ); |
|
102 | + ); |
|
103 | 103 | |
104 | - foreach ($table->getColumns() as $column) { |
|
105 | - $content .= str_replace(['{{name}}', '{{type}}'], [$column->getName(), $column->getType()->getName()], <<<'EOT' |
|
104 | + foreach ($table->getColumns() as $column) { |
|
105 | + $content .= str_replace(['{{name}}', '{{type}}'], [$column->getName(), $column->getType()->getName()], <<<'EOT' |
|
106 | 106 | $table->addColumn('{{name}}', '{{type}}', [ |
107 | 107 | |
108 | 108 | EOT |
109 | - ); |
|
110 | - if ($column->getAutoincrement()) { |
|
111 | - $content .= <<<'EOT' |
|
109 | + ); |
|
110 | + if ($column->getAutoincrement()) { |
|
111 | + $content .= <<<'EOT' |
|
112 | 112 | 'autoincrement' => true, |
113 | 113 | |
114 | 114 | EOT; |
115 | - } |
|
116 | - $content .= str_replace('{{notnull}}', $column->getNotnull() ? 'true' : 'false', <<<'EOT' |
|
115 | + } |
|
116 | + $content .= str_replace('{{notnull}}', $column->getNotnull() ? 'true' : 'false', <<<'EOT' |
|
117 | 117 | 'notnull' => {{notnull}}, |
118 | 118 | |
119 | 119 | EOT |
120 | - ); |
|
121 | - if ($column->getLength() !== null) { |
|
122 | - $content .= str_replace('{{length}}', $column->getLength(), <<<'EOT' |
|
120 | + ); |
|
121 | + if ($column->getLength() !== null) { |
|
122 | + $content .= str_replace('{{length}}', $column->getLength(), <<<'EOT' |
|
123 | 123 | 'length' => {{length}}, |
124 | 124 | |
125 | 125 | EOT |
126 | - ); |
|
127 | - } |
|
128 | - $default = $column->getDefault(); |
|
129 | - if ($default !== null) { |
|
130 | - if (is_string($default)) { |
|
131 | - $default = "'$default'"; |
|
132 | - } elseif (is_bool($default)) { |
|
133 | - $default = ($default === true) ? 'true' : 'false'; |
|
134 | - } |
|
135 | - $content .= str_replace('{{default}}', $default, <<<'EOT' |
|
126 | + ); |
|
127 | + } |
|
128 | + $default = $column->getDefault(); |
|
129 | + if ($default !== null) { |
|
130 | + if (is_string($default)) { |
|
131 | + $default = "'$default'"; |
|
132 | + } elseif (is_bool($default)) { |
|
133 | + $default = ($default === true) ? 'true' : 'false'; |
|
134 | + } |
|
135 | + $content .= str_replace('{{default}}', $default, <<<'EOT' |
|
136 | 136 | 'default' => {{default}}, |
137 | 137 | |
138 | 138 | EOT |
139 | - ); |
|
140 | - } |
|
141 | - if ($column->getUnsigned()) { |
|
142 | - $content .= <<<'EOT' |
|
139 | + ); |
|
140 | + } |
|
141 | + if ($column->getUnsigned()) { |
|
142 | + $content .= <<<'EOT' |
|
143 | 143 | 'unsigned' => true, |
144 | 144 | |
145 | 145 | EOT; |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - $content .= <<<'EOT' |
|
148 | + $content .= <<<'EOT' |
|
149 | 149 | ]); |
150 | 150 | |
151 | 151 | EOT; |
152 | - } |
|
152 | + } |
|
153 | 153 | |
154 | - $content .= <<<'EOT' |
|
154 | + $content .= <<<'EOT' |
|
155 | 155 | |
156 | 156 | EOT; |
157 | 157 | |
158 | - $primaryKey = $table->getPrimaryKey(); |
|
159 | - if ($primaryKey !== null) { |
|
160 | - $content .= str_replace('{{columns}}', implode('\', \'', $primaryKey->getUnquotedColumns()), <<<'EOT' |
|
158 | + $primaryKey = $table->getPrimaryKey(); |
|
159 | + if ($primaryKey !== null) { |
|
160 | + $content .= str_replace('{{columns}}', implode('\', \'', $primaryKey->getUnquotedColumns()), <<<'EOT' |
|
161 | 161 | $table->setPrimaryKey(['{{columns}}']); |
162 | 162 | |
163 | 163 | EOT |
164 | - ); |
|
165 | - } |
|
166 | - |
|
167 | - foreach ($table->getIndexes() as $index) { |
|
168 | - if ($index->isPrimary()) { |
|
169 | - continue; |
|
170 | - } |
|
171 | - |
|
172 | - if ($index->isUnique()) { |
|
173 | - $content .= str_replace( |
|
174 | - ['{{columns}}', '{{name}}'], |
|
175 | - [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
176 | - <<<'EOT' |
|
164 | + ); |
|
165 | + } |
|
166 | + |
|
167 | + foreach ($table->getIndexes() as $index) { |
|
168 | + if ($index->isPrimary()) { |
|
169 | + continue; |
|
170 | + } |
|
171 | + |
|
172 | + if ($index->isUnique()) { |
|
173 | + $content .= str_replace( |
|
174 | + ['{{columns}}', '{{name}}'], |
|
175 | + [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
176 | + <<<'EOT' |
|
177 | 177 | $table->addUniqueIndex(['{{columns}}'], '{{name}}'); |
178 | 178 | |
179 | 179 | EOT |
180 | - ); |
|
181 | - } else { |
|
182 | - $content .= str_replace( |
|
183 | - ['{{columns}}', '{{name}}'], |
|
184 | - [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
185 | - <<<'EOT' |
|
180 | + ); |
|
181 | + } else { |
|
182 | + $content .= str_replace( |
|
183 | + ['{{columns}}', '{{name}}'], |
|
184 | + [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
185 | + <<<'EOT' |
|
186 | 186 | $table->addIndex(['{{columns}}'], '{{name}}'); |
187 | 187 | |
188 | 188 | EOT |
189 | - ); |
|
190 | - } |
|
191 | - } |
|
189 | + ); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | - $content .= <<<'EOT' |
|
193 | + $content .= <<<'EOT' |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | EOT; |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - $content .= <<<'EOT' |
|
199 | + $content .= <<<'EOT' |
|
200 | 200 | return $schema; |
201 | 201 | EOT; |
202 | 202 | |
203 | - return $content; |
|
204 | - } |
|
203 | + return $content; |
|
204 | + } |
|
205 | 205 | } |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class FileDeleted implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'file_deleted'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'file_deleted'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A file or folder has been <strong>deleted</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A file or folder has been <strong>deleted</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 3; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 3; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |