@@ -29,58 +29,58 @@ |
||
29 | 29 | use OCP\Settings\IIconSection; |
30 | 30 | |
31 | 31 | class PersonalSection implements IIconSection { |
32 | - /** @var IURLGenerator */ |
|
33 | - private $urlGenerator; |
|
34 | - /** @var IL10N */ |
|
35 | - private $l; |
|
32 | + /** @var IURLGenerator */ |
|
33 | + private $urlGenerator; |
|
34 | + /** @var IL10N */ |
|
35 | + private $l; |
|
36 | 36 | |
37 | - public function __construct(IURLGenerator $urlGenerator, IL10N $l) { |
|
38 | - $this->urlGenerator = $urlGenerator; |
|
39 | - $this->l = $l; |
|
40 | - } |
|
37 | + public function __construct(IURLGenerator $urlGenerator, IL10N $l) { |
|
38 | + $this->urlGenerator = $urlGenerator; |
|
39 | + $this->l = $l; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * returns the relative path to an 16*16 icon describing the section. |
|
44 | - * e.g. '/core/img/places/files.svg' |
|
45 | - * |
|
46 | - * @returns string |
|
47 | - * @since 13.0.0 |
|
48 | - */ |
|
49 | - public function getIcon() { |
|
50 | - return $this->urlGenerator->imagePath('core', 'actions/share.svg'); |
|
51 | - } |
|
42 | + /** |
|
43 | + * returns the relative path to an 16*16 icon describing the section. |
|
44 | + * e.g. '/core/img/places/files.svg' |
|
45 | + * |
|
46 | + * @returns string |
|
47 | + * @since 13.0.0 |
|
48 | + */ |
|
49 | + public function getIcon() { |
|
50 | + return $this->urlGenerator->imagePath('core', 'actions/share.svg'); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
55 | - * e.g. 'ldap' |
|
56 | - * |
|
57 | - * @returns string |
|
58 | - * @since 9.1 |
|
59 | - */ |
|
60 | - public function getID() { |
|
61 | - return 'sharing'; |
|
62 | - } |
|
53 | + /** |
|
54 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
55 | + * e.g. 'ldap' |
|
56 | + * |
|
57 | + * @returns string |
|
58 | + * @since 9.1 |
|
59 | + */ |
|
60 | + public function getID() { |
|
61 | + return 'sharing'; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
66 | - * integration'. Use the L10N service to translate it. |
|
67 | - * |
|
68 | - * @return string |
|
69 | - * @since 9.1 |
|
70 | - */ |
|
71 | - public function getName() { |
|
72 | - return $this->l->t('Sharing'); |
|
73 | - } |
|
64 | + /** |
|
65 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
66 | + * integration'. Use the L10N service to translate it. |
|
67 | + * |
|
68 | + * @return string |
|
69 | + * @since 9.1 |
|
70 | + */ |
|
71 | + public function getName() { |
|
72 | + return $this->l->t('Sharing'); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @return int whether the form should be rather on the top or bottom of |
|
77 | - * the settings navigation. The sections are arranged in ascending order of |
|
78 | - * the priority values. It is required to return a value between 0 and 99. |
|
79 | - * |
|
80 | - * E.g.: 70 |
|
81 | - * @since 9.1 |
|
82 | - */ |
|
83 | - public function getPriority() { |
|
84 | - return 15; |
|
85 | - } |
|
75 | + /** |
|
76 | + * @return int whether the form should be rather on the top or bottom of |
|
77 | + * the settings navigation. The sections are arranged in ascending order of |
|
78 | + * the priority values. It is required to return a value between 0 and 99. |
|
79 | + * |
|
80 | + * E.g.: 70 |
|
81 | + * @since 9.1 |
|
82 | + */ |
|
83 | + public function getPriority() { |
|
84 | + return 15; |
|
85 | + } |
|
86 | 86 | } |
@@ -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 | } |
@@ -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; |
@@ -37,170 +37,170 @@ |
||
37 | 37 | |
38 | 38 | class GenerateFromSchemaFileCommand extends GenerateCommand { |
39 | 39 | |
40 | - /** @var IConfig */ |
|
41 | - protected $config; |
|
40 | + /** @var IConfig */ |
|
41 | + protected $config; |
|
42 | 42 | |
43 | - public function __construct(IConfig $config, IAppManager $appManager, Connection $connection) { |
|
44 | - parent::__construct($connection, $appManager); |
|
45 | - $this->config = $config; |
|
46 | - } |
|
43 | + public function __construct(IConfig $config, IAppManager $appManager, Connection $connection) { |
|
44 | + parent::__construct($connection, $appManager); |
|
45 | + $this->config = $config; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - protected function configure() { |
|
50 | - parent::configure(); |
|
49 | + protected function configure() { |
|
50 | + parent::configure(); |
|
51 | 51 | |
52 | - $this->setName('migrations:generate-from-schema'); |
|
53 | - } |
|
52 | + $this->setName('migrations:generate-from-schema'); |
|
53 | + } |
|
54 | 54 | |
55 | - public function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | - $appName = $input->getArgument('app'); |
|
57 | - $version = $input->getArgument('version'); |
|
55 | + public function execute(InputInterface $input, OutputInterface $output): int { |
|
56 | + $appName = $input->getArgument('app'); |
|
57 | + $version = $input->getArgument('version'); |
|
58 | 58 | |
59 | - if (!preg_match('/^\d{1,16}$/',$version)) { |
|
60 | - $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
|
61 | - return 1; |
|
62 | - } |
|
59 | + if (!preg_match('/^\d{1,16}$/',$version)) { |
|
60 | + $output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>'); |
|
61 | + return 1; |
|
62 | + } |
|
63 | 63 | |
64 | - $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
65 | - if (!file_exists($schemaFile)) { |
|
66 | - $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
67 | - return 2; |
|
68 | - } |
|
64 | + $schemaFile = $this->appManager->getAppPath($appName) . '/appinfo/database.xml'; |
|
65 | + if (!file_exists($schemaFile)) { |
|
66 | + $output->writeln('<error>App ' . $appName . ' does not have a database.xml file</error>'); |
|
67 | + return 2; |
|
68 | + } |
|
69 | 69 | |
70 | - $reader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); |
|
71 | - $schema = new Schema(); |
|
72 | - $reader->loadSchemaFromFile($schemaFile, $schema); |
|
70 | + $reader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform()); |
|
71 | + $schema = new Schema(); |
|
72 | + $reader->loadSchemaFromFile($schemaFile, $schema); |
|
73 | 73 | |
74 | - $schemaBody = $this->schemaToMigration($schema); |
|
74 | + $schemaBody = $this->schemaToMigration($schema); |
|
75 | 75 | |
76 | - $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
76 | + $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); |
|
77 | 77 | |
78 | - $date = date('YmdHis'); |
|
79 | - $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
78 | + $date = date('YmdHis'); |
|
79 | + $path = $this->generateMigration($ms, 'Version' . $version . 'Date' . $date, $schemaBody); |
|
80 | 80 | |
81 | - $output->writeln("New migration class has been generated to <info>$path</info>"); |
|
82 | - return 0; |
|
83 | - } |
|
81 | + $output->writeln("New migration class has been generated to <info>$path</info>"); |
|
82 | + return 0; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @param Schema $schema |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - protected function schemaToMigration(Schema $schema) { |
|
90 | - $content = <<<'EOT' |
|
85 | + /** |
|
86 | + * @param Schema $schema |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + protected function schemaToMigration(Schema $schema) { |
|
90 | + $content = <<<'EOT' |
|
91 | 91 | /** @var ISchemaWrapper $schema */ |
92 | 92 | $schema = $schemaClosure(); |
93 | 93 | |
94 | 94 | EOT; |
95 | 95 | |
96 | - foreach ($schema->getTables() as $table) { |
|
97 | - $content .= str_replace('{{table-name}}', substr($table->getName(), 3), <<<'EOT' |
|
96 | + foreach ($schema->getTables() as $table) { |
|
97 | + $content .= str_replace('{{table-name}}', substr($table->getName(), 3), <<<'EOT' |
|
98 | 98 | |
99 | 99 | if (!$schema->hasTable('{{table-name}}')) { |
100 | 100 | $table = $schema->createTable('{{table-name}}'); |
101 | 101 | |
102 | 102 | EOT |
103 | - ); |
|
103 | + ); |
|
104 | 104 | |
105 | - foreach ($table->getColumns() as $column) { |
|
106 | - $content .= str_replace(['{{name}}', '{{type}}'], [$column->getName(), $column->getType()->getName()], <<<'EOT' |
|
105 | + foreach ($table->getColumns() as $column) { |
|
106 | + $content .= str_replace(['{{name}}', '{{type}}'], [$column->getName(), $column->getType()->getName()], <<<'EOT' |
|
107 | 107 | $table->addColumn('{{name}}', '{{type}}', [ |
108 | 108 | |
109 | 109 | EOT |
110 | - ); |
|
111 | - if ($column->getAutoincrement()) { |
|
112 | - $content .= <<<'EOT' |
|
110 | + ); |
|
111 | + if ($column->getAutoincrement()) { |
|
112 | + $content .= <<<'EOT' |
|
113 | 113 | 'autoincrement' => true, |
114 | 114 | |
115 | 115 | EOT; |
116 | - } |
|
117 | - $content .= str_replace('{{notnull}}', $column->getNotnull() ? 'true' : 'false', <<<'EOT' |
|
116 | + } |
|
117 | + $content .= str_replace('{{notnull}}', $column->getNotnull() ? 'true' : 'false', <<<'EOT' |
|
118 | 118 | 'notnull' => {{notnull}}, |
119 | 119 | |
120 | 120 | EOT |
121 | - ); |
|
122 | - if ($column->getLength() !== null) { |
|
123 | - $content .= str_replace('{{length}}', $column->getLength(), <<<'EOT' |
|
121 | + ); |
|
122 | + if ($column->getLength() !== null) { |
|
123 | + $content .= str_replace('{{length}}', $column->getLength(), <<<'EOT' |
|
124 | 124 | 'length' => {{length}}, |
125 | 125 | |
126 | 126 | EOT |
127 | - ); |
|
128 | - } |
|
129 | - $default = $column->getDefault(); |
|
130 | - if ($default !== null) { |
|
131 | - if (is_string($default)) { |
|
132 | - $default = "'$default'"; |
|
133 | - } elseif (is_bool($default)) { |
|
134 | - $default = ($default === true) ? 'true' : 'false'; |
|
135 | - } |
|
136 | - $content .= str_replace('{{default}}', $default, <<<'EOT' |
|
127 | + ); |
|
128 | + } |
|
129 | + $default = $column->getDefault(); |
|
130 | + if ($default !== null) { |
|
131 | + if (is_string($default)) { |
|
132 | + $default = "'$default'"; |
|
133 | + } elseif (is_bool($default)) { |
|
134 | + $default = ($default === true) ? 'true' : 'false'; |
|
135 | + } |
|
136 | + $content .= str_replace('{{default}}', $default, <<<'EOT' |
|
137 | 137 | 'default' => {{default}}, |
138 | 138 | |
139 | 139 | EOT |
140 | - ); |
|
141 | - } |
|
142 | - if ($column->getUnsigned()) { |
|
143 | - $content .= <<<'EOT' |
|
140 | + ); |
|
141 | + } |
|
142 | + if ($column->getUnsigned()) { |
|
143 | + $content .= <<<'EOT' |
|
144 | 144 | 'unsigned' => true, |
145 | 145 | |
146 | 146 | EOT; |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - $content .= <<<'EOT' |
|
149 | + $content .= <<<'EOT' |
|
150 | 150 | ]); |
151 | 151 | |
152 | 152 | EOT; |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | - $content .= <<<'EOT' |
|
155 | + $content .= <<<'EOT' |
|
156 | 156 | |
157 | 157 | EOT; |
158 | 158 | |
159 | - $primaryKey = $table->getPrimaryKey(); |
|
160 | - if ($primaryKey !== null) { |
|
161 | - $content .= str_replace('{{columns}}', implode('\', \'', $primaryKey->getUnquotedColumns()), <<<'EOT' |
|
159 | + $primaryKey = $table->getPrimaryKey(); |
|
160 | + if ($primaryKey !== null) { |
|
161 | + $content .= str_replace('{{columns}}', implode('\', \'', $primaryKey->getUnquotedColumns()), <<<'EOT' |
|
162 | 162 | $table->setPrimaryKey(['{{columns}}']); |
163 | 163 | |
164 | 164 | EOT |
165 | - ); |
|
166 | - } |
|
167 | - |
|
168 | - foreach ($table->getIndexes() as $index) { |
|
169 | - if ($index->isPrimary()) { |
|
170 | - continue; |
|
171 | - } |
|
172 | - |
|
173 | - if ($index->isUnique()) { |
|
174 | - $content .= str_replace( |
|
175 | - ['{{columns}}', '{{name}}'], |
|
176 | - [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
177 | - <<<'EOT' |
|
165 | + ); |
|
166 | + } |
|
167 | + |
|
168 | + foreach ($table->getIndexes() as $index) { |
|
169 | + if ($index->isPrimary()) { |
|
170 | + continue; |
|
171 | + } |
|
172 | + |
|
173 | + if ($index->isUnique()) { |
|
174 | + $content .= str_replace( |
|
175 | + ['{{columns}}', '{{name}}'], |
|
176 | + [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
177 | + <<<'EOT' |
|
178 | 178 | $table->addUniqueIndex(['{{columns}}'], '{{name}}'); |
179 | 179 | |
180 | 180 | EOT |
181 | - ); |
|
182 | - } else { |
|
183 | - $content .= str_replace( |
|
184 | - ['{{columns}}', '{{name}}'], |
|
185 | - [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
186 | - <<<'EOT' |
|
181 | + ); |
|
182 | + } else { |
|
183 | + $content .= str_replace( |
|
184 | + ['{{columns}}', '{{name}}'], |
|
185 | + [implode('\', \'', $index->getUnquotedColumns()), $index->getName()], |
|
186 | + <<<'EOT' |
|
187 | 187 | $table->addIndex(['{{columns}}'], '{{name}}'); |
188 | 188 | |
189 | 189 | EOT |
190 | - ); |
|
191 | - } |
|
192 | - } |
|
190 | + ); |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | - $content .= <<<'EOT' |
|
194 | + $content .= <<<'EOT' |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | EOT; |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - $content .= <<<'EOT' |
|
200 | + $content .= <<<'EOT' |
|
201 | 201 | return $schema; |
202 | 202 | EOT; |
203 | 203 | |
204 | - return $content; |
|
205 | - } |
|
204 | + return $content; |
|
205 | + } |
|
206 | 206 | } |
@@ -29,39 +29,39 @@ |
||
29 | 29 | |
30 | 30 | class ConfigController extends OCSController { |
31 | 31 | |
32 | - /** @var IConfig */ |
|
33 | - private $config; |
|
32 | + /** @var IConfig */ |
|
33 | + private $config; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param string $appName |
|
37 | - * @param IRequest $request |
|
38 | - * @param IConfig $config |
|
39 | - */ |
|
40 | - public function __construct($appName, |
|
41 | - IRequest $request, |
|
42 | - IConfig $config) { |
|
43 | - parent::__construct($appName, $request); |
|
44 | - $this->config = $config; |
|
45 | - } |
|
35 | + /** |
|
36 | + * @param string $appName |
|
37 | + * @param IRequest $request |
|
38 | + * @param IConfig $config |
|
39 | + */ |
|
40 | + public function __construct($appName, |
|
41 | + IRequest $request, |
|
42 | + IConfig $config) { |
|
43 | + parent::__construct($appName, $request); |
|
44 | + $this->config = $config; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $appid |
|
49 | - * @param string $configkey |
|
50 | - * @param string $value |
|
51 | - * @return DataResponse |
|
52 | - */ |
|
53 | - public function setAppValue($appid, $configkey, $value) { |
|
54 | - $this->config->setAppValue($appid, $configkey, $value); |
|
55 | - return new DataResponse(); |
|
56 | - } |
|
47 | + /** |
|
48 | + * @param string $appid |
|
49 | + * @param string $configkey |
|
50 | + * @param string $value |
|
51 | + * @return DataResponse |
|
52 | + */ |
|
53 | + public function setAppValue($appid, $configkey, $value) { |
|
54 | + $this->config->setAppValue($appid, $configkey, $value); |
|
55 | + return new DataResponse(); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $appid |
|
60 | - * @param string $configkey |
|
61 | - * @return DataResponse |
|
62 | - */ |
|
63 | - public function deleteAppValue($appid, $configkey) { |
|
64 | - $this->config->deleteAppValue($appid, $configkey); |
|
65 | - return new DataResponse(); |
|
66 | - } |
|
58 | + /** |
|
59 | + * @param string $appid |
|
60 | + * @param string $configkey |
|
61 | + * @return DataResponse |
|
62 | + */ |
|
63 | + public function deleteAppValue($appid, $configkey) { |
|
64 | + $this->config->deleteAppValue($appid, $configkey); |
|
65 | + return new DataResponse(); |
|
66 | + } |
|
67 | 67 | } |
@@ -33,12 +33,12 @@ |
||
33 | 33 | */ |
34 | 34 | interface ICallbackResponse { |
35 | 35 | |
36 | - /** |
|
37 | - * Outputs the content that should be printed |
|
38 | - * |
|
39 | - * @param IOutput $output a small wrapper that handles output |
|
40 | - * @since 8.1.0 |
|
41 | - */ |
|
42 | - public function callback(IOutput $output); |
|
36 | + /** |
|
37 | + * Outputs the content that should be printed |
|
38 | + * |
|
39 | + * @param IOutput $output a small wrapper that handles output |
|
40 | + * @since 8.1.0 |
|
41 | + */ |
|
42 | + public function callback(IOutput $output); |
|
43 | 43 | |
44 | 44 | } |