@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | require '../../../../3rdparty/autoload.php'; |
24 | 24 | |
25 | 25 | if ($argc !== 6) { |
26 | - echo "Invalid number of arguments" . PHP_EOL; |
|
27 | - exit; |
|
26 | + echo "Invalid number of arguments" . PHP_EOL; |
|
27 | + exit; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * @return mixed |
34 | 34 | */ |
35 | 35 | function request($client, $method, $uploadUrl, $data = null, $headers = []) { |
36 | - echo "$method $uploadUrl ... "; |
|
37 | - $t0 = microtime(true); |
|
38 | - $result = $client->request($method, $uploadUrl, $data, $headers); |
|
39 | - $t1 = microtime(true); |
|
40 | - echo $result['statusCode'] . " - " . ($t1 - $t0) . ' seconds' . PHP_EOL; |
|
41 | - if (!in_array($result['statusCode'], [200, 201])) { |
|
42 | - echo $result['body'] . PHP_EOL; |
|
43 | - } |
|
44 | - return $result; |
|
36 | + echo "$method $uploadUrl ... "; |
|
37 | + $t0 = microtime(true); |
|
38 | + $result = $client->request($method, $uploadUrl, $data, $headers); |
|
39 | + $t1 = microtime(true); |
|
40 | + echo $result['statusCode'] . " - " . ($t1 - $t0) . ' seconds' . PHP_EOL; |
|
41 | + if (!in_array($result['statusCode'], [200, 201])) { |
|
42 | + echo $result['body'] . PHP_EOL; |
|
43 | + } |
|
44 | + return $result; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $baseUri = $argv[1]; |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $chunkSize = $argv[5] * 1024 * 1024; |
52 | 52 | |
53 | 53 | $client = new \Sabre\DAV\Client([ |
54 | - 'baseUri' => $baseUri, |
|
55 | - 'userName' => $userName, |
|
56 | - 'password' => $password |
|
54 | + 'baseUri' => $baseUri, |
|
55 | + 'userName' => $userName, |
|
56 | + 'password' => $password |
|
57 | 57 | ]); |
58 | 58 | |
59 | 59 | $transfer = uniqid('transfer', true); |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | |
67 | 67 | $index = 0; |
68 | 68 | while(!feof($stream)) { |
69 | - request($client, 'PUT', "$uploadUrl/$index", fread($stream, $chunkSize)); |
|
70 | - $index++; |
|
69 | + request($client, 'PUT', "$uploadUrl/$index", fread($stream, $chunkSize)); |
|
70 | + $index++; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $destination = pathinfo($file, PATHINFO_BASENAME); |
74 | 74 | //echo "Moving $uploadUrl/.file to it's final destination $baseUri/files/$userName/$destination" . PHP_EOL; |
75 | 75 | request($client, 'MOVE', "$uploadUrl/.file", null, [ |
76 | - 'Destination' => "$baseUri/files/$userName/$destination" |
|
76 | + 'Destination' => "$baseUri/files/$userName/$destination" |
|
77 | 77 | ]); |
@@ -25,64 +25,64 @@ |
||
25 | 25 | use OCP\ILogger; |
26 | 26 | |
27 | 27 | class Action { |
28 | - /** @var ILogger */ |
|
29 | - private $logger; |
|
28 | + /** @var ILogger */ |
|
29 | + private $logger; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @param ILogger $logger |
|
33 | - */ |
|
34 | - public function __construct(ILogger $logger) { |
|
35 | - $this->logger = $logger; |
|
36 | - } |
|
31 | + /** |
|
32 | + * @param ILogger $logger |
|
33 | + */ |
|
34 | + public function __construct(ILogger $logger) { |
|
35 | + $this->logger = $logger; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Log a single action with a log level of info |
|
40 | - * |
|
41 | - * @param string $text |
|
42 | - * @param array $params |
|
43 | - * @param array $elements |
|
44 | - * @param bool $obfuscateParameters |
|
45 | - */ |
|
46 | - public function log($text, |
|
47 | - array $params, |
|
48 | - array $elements, |
|
49 | - $obfuscateParameters = false) { |
|
50 | - foreach($elements as $element) { |
|
51 | - if(!isset($params[$element])) { |
|
52 | - if ($obfuscateParameters) { |
|
53 | - $this->logger->critical( |
|
54 | - '$params["'.$element.'"] was missing.', |
|
55 | - ['app' => 'admin_audit'] |
|
56 | - ); |
|
57 | - } else { |
|
58 | - $this->logger->critical( |
|
59 | - sprintf( |
|
60 | - '$params["'.$element.'"] was missing. Transferred value: %s', |
|
61 | - print_r($params, true) |
|
62 | - ), |
|
63 | - ['app' => 'admin_audit'] |
|
64 | - ); |
|
65 | - } |
|
66 | - return; |
|
67 | - } |
|
68 | - } |
|
38 | + /** |
|
39 | + * Log a single action with a log level of info |
|
40 | + * |
|
41 | + * @param string $text |
|
42 | + * @param array $params |
|
43 | + * @param array $elements |
|
44 | + * @param bool $obfuscateParameters |
|
45 | + */ |
|
46 | + public function log($text, |
|
47 | + array $params, |
|
48 | + array $elements, |
|
49 | + $obfuscateParameters = false) { |
|
50 | + foreach($elements as $element) { |
|
51 | + if(!isset($params[$element])) { |
|
52 | + if ($obfuscateParameters) { |
|
53 | + $this->logger->critical( |
|
54 | + '$params["'.$element.'"] was missing.', |
|
55 | + ['app' => 'admin_audit'] |
|
56 | + ); |
|
57 | + } else { |
|
58 | + $this->logger->critical( |
|
59 | + sprintf( |
|
60 | + '$params["'.$element.'"] was missing. Transferred value: %s', |
|
61 | + print_r($params, true) |
|
62 | + ), |
|
63 | + ['app' => 'admin_audit'] |
|
64 | + ); |
|
65 | + } |
|
66 | + return; |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - $replaceArray = []; |
|
71 | - foreach($elements as $element) { |
|
72 | - if($params[$element] instanceof \DateTime) { |
|
73 | - $params[$element] = $params[$element]->format('Y-m-d H:i:s'); |
|
74 | - } |
|
75 | - $replaceArray[] = $params[$element]; |
|
76 | - } |
|
70 | + $replaceArray = []; |
|
71 | + foreach($elements as $element) { |
|
72 | + if($params[$element] instanceof \DateTime) { |
|
73 | + $params[$element] = $params[$element]->format('Y-m-d H:i:s'); |
|
74 | + } |
|
75 | + $replaceArray[] = $params[$element]; |
|
76 | + } |
|
77 | 77 | |
78 | - $this->logger->info( |
|
79 | - vsprintf( |
|
80 | - $text, |
|
81 | - $replaceArray |
|
82 | - ), |
|
83 | - [ |
|
84 | - 'app' => 'admin_audit' |
|
85 | - ] |
|
86 | - ); |
|
87 | - } |
|
78 | + $this->logger->info( |
|
79 | + vsprintf( |
|
80 | + $text, |
|
81 | + $replaceArray |
|
82 | + ), |
|
83 | + [ |
|
84 | + 'app' => 'admin_audit' |
|
85 | + ] |
|
86 | + ); |
|
87 | + } |
|
88 | 88 | } |
@@ -28,33 +28,33 @@ |
||
28 | 28 | * @package OCA\Admin_Audit\Actions |
29 | 29 | */ |
30 | 30 | class Auth extends Action { |
31 | - public function loginAttempt(array $params) { |
|
32 | - $this->log( |
|
33 | - 'Login attempt: "%s"', |
|
34 | - $params, |
|
35 | - [ |
|
36 | - 'uid', |
|
37 | - ], |
|
38 | - true |
|
39 | - ); |
|
40 | - } |
|
31 | + public function loginAttempt(array $params) { |
|
32 | + $this->log( |
|
33 | + 'Login attempt: "%s"', |
|
34 | + $params, |
|
35 | + [ |
|
36 | + 'uid', |
|
37 | + ], |
|
38 | + true |
|
39 | + ); |
|
40 | + } |
|
41 | 41 | |
42 | - public function loginSuccessful(array $params) { |
|
43 | - $this->log( |
|
44 | - 'Login successful: "%s"', |
|
45 | - $params, |
|
46 | - [ |
|
47 | - 'uid', |
|
48 | - ], |
|
49 | - true |
|
50 | - ); |
|
51 | - } |
|
42 | + public function loginSuccessful(array $params) { |
|
43 | + $this->log( |
|
44 | + 'Login successful: "%s"', |
|
45 | + $params, |
|
46 | + [ |
|
47 | + 'uid', |
|
48 | + ], |
|
49 | + true |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | - public function logout(array $params) { |
|
54 | - $this->log( |
|
55 | - 'Logout occurred', |
|
56 | - [], |
|
57 | - [] |
|
58 | - ); |
|
59 | - } |
|
53 | + public function logout(array $params) { |
|
54 | + $this->log( |
|
55 | + 'Logout occurred', |
|
56 | + [], |
|
57 | + [] |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | } |
@@ -27,21 +27,21 @@ |
||
27 | 27 | |
28 | 28 | class Versions extends Action { |
29 | 29 | |
30 | - public function rollback($params) { |
|
31 | - $this->log('Version "%s" of "%s" was restored.', |
|
32 | - [ |
|
33 | - 'version' => $params['revision'], |
|
34 | - 'path' => $params['path'] |
|
35 | - ], |
|
36 | - ['version', 'path'] |
|
37 | - ); |
|
38 | - } |
|
30 | + public function rollback($params) { |
|
31 | + $this->log('Version "%s" of "%s" was restored.', |
|
32 | + [ |
|
33 | + 'version' => $params['revision'], |
|
34 | + 'path' => $params['path'] |
|
35 | + ], |
|
36 | + ['version', 'path'] |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | |
40 | - public function delete($params) { |
|
41 | - $this->log('Version "%s" was deleted.', |
|
42 | - ['path' => $params['path']], |
|
43 | - ['path'] |
|
44 | - ); |
|
45 | - } |
|
40 | + public function delete($params) { |
|
41 | + $this->log('Version "%s" was deleted.', |
|
42 | + ['path' => $params['path']], |
|
43 | + ['path'] |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -29,163 +29,163 @@ |
||
29 | 29 | * @package OCA\Admin_Audit\Actions |
30 | 30 | */ |
31 | 31 | class Sharing extends Action { |
32 | - /** |
|
33 | - * Logs sharing of data |
|
34 | - * |
|
35 | - * @param array $params |
|
36 | - */ |
|
37 | - public function shared(array $params) { |
|
38 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
39 | - $this->log( |
|
40 | - 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', |
|
41 | - $params, |
|
42 | - [ |
|
43 | - 'itemType', |
|
44 | - 'itemTarget', |
|
45 | - 'itemSource', |
|
46 | - 'permissions', |
|
47 | - 'id', |
|
48 | - ] |
|
49 | - ); |
|
50 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
51 | - $this->log( |
|
52 | - 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', |
|
53 | - $params, |
|
54 | - [ |
|
55 | - 'itemType', |
|
56 | - 'itemTarget', |
|
57 | - 'itemSource', |
|
58 | - 'shareWith', |
|
59 | - 'permissions', |
|
60 | - 'id', |
|
61 | - ] |
|
62 | - ); |
|
63 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
64 | - $this->log( |
|
65 | - 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', |
|
66 | - $params, |
|
67 | - [ |
|
68 | - 'itemType', |
|
69 | - 'itemTarget', |
|
70 | - 'itemSource', |
|
71 | - 'shareWith', |
|
72 | - 'permissions', |
|
73 | - 'id', |
|
74 | - ] |
|
75 | - ); |
|
76 | - } |
|
77 | - } |
|
32 | + /** |
|
33 | + * Logs sharing of data |
|
34 | + * |
|
35 | + * @param array $params |
|
36 | + */ |
|
37 | + public function shared(array $params) { |
|
38 | + if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
39 | + $this->log( |
|
40 | + 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', |
|
41 | + $params, |
|
42 | + [ |
|
43 | + 'itemType', |
|
44 | + 'itemTarget', |
|
45 | + 'itemSource', |
|
46 | + 'permissions', |
|
47 | + 'id', |
|
48 | + ] |
|
49 | + ); |
|
50 | + } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
51 | + $this->log( |
|
52 | + 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', |
|
53 | + $params, |
|
54 | + [ |
|
55 | + 'itemType', |
|
56 | + 'itemTarget', |
|
57 | + 'itemSource', |
|
58 | + 'shareWith', |
|
59 | + 'permissions', |
|
60 | + 'id', |
|
61 | + ] |
|
62 | + ); |
|
63 | + } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
64 | + $this->log( |
|
65 | + 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', |
|
66 | + $params, |
|
67 | + [ |
|
68 | + 'itemType', |
|
69 | + 'itemTarget', |
|
70 | + 'itemSource', |
|
71 | + 'shareWith', |
|
72 | + 'permissions', |
|
73 | + 'id', |
|
74 | + ] |
|
75 | + ); |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Logs unsharing of data |
|
81 | - * |
|
82 | - * @param array $params |
|
83 | - */ |
|
84 | - public function unshare(array $params) { |
|
85 | - if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
86 | - $this->log( |
|
87 | - 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
|
88 | - $params, |
|
89 | - [ |
|
90 | - 'itemType', |
|
91 | - 'fileTarget', |
|
92 | - 'itemSource', |
|
93 | - 'id', |
|
94 | - ] |
|
95 | - ); |
|
96 | - } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
97 | - $this->log( |
|
98 | - 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
|
99 | - $params, |
|
100 | - [ |
|
101 | - 'itemType', |
|
102 | - 'fileTarget', |
|
103 | - 'itemSource', |
|
104 | - 'shareWith', |
|
105 | - 'id', |
|
106 | - ] |
|
107 | - ); |
|
108 | - } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
109 | - $this->log( |
|
110 | - 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
|
111 | - $params, |
|
112 | - [ |
|
113 | - 'itemType', |
|
114 | - 'fileTarget', |
|
115 | - 'itemSource', |
|
116 | - 'shareWith', |
|
117 | - 'id', |
|
118 | - ] |
|
119 | - ); |
|
120 | - } |
|
121 | - } |
|
79 | + /** |
|
80 | + * Logs unsharing of data |
|
81 | + * |
|
82 | + * @param array $params |
|
83 | + */ |
|
84 | + public function unshare(array $params) { |
|
85 | + if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
|
86 | + $this->log( |
|
87 | + 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
|
88 | + $params, |
|
89 | + [ |
|
90 | + 'itemType', |
|
91 | + 'fileTarget', |
|
92 | + 'itemSource', |
|
93 | + 'id', |
|
94 | + ] |
|
95 | + ); |
|
96 | + } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
|
97 | + $this->log( |
|
98 | + 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
|
99 | + $params, |
|
100 | + [ |
|
101 | + 'itemType', |
|
102 | + 'fileTarget', |
|
103 | + 'itemSource', |
|
104 | + 'shareWith', |
|
105 | + 'id', |
|
106 | + ] |
|
107 | + ); |
|
108 | + } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
|
109 | + $this->log( |
|
110 | + 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
|
111 | + $params, |
|
112 | + [ |
|
113 | + 'itemType', |
|
114 | + 'fileTarget', |
|
115 | + 'itemSource', |
|
116 | + 'shareWith', |
|
117 | + 'id', |
|
118 | + ] |
|
119 | + ); |
|
120 | + } |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Logs the updating of permission changes for shares |
|
125 | - * |
|
126 | - * @param array $params |
|
127 | - */ |
|
128 | - public function updatePermissions(array $params) { |
|
129 | - $this->log( |
|
130 | - 'The permissions of the shared %s "%s" with ID "%s" have been changed to "%s"', |
|
131 | - $params, |
|
132 | - [ |
|
133 | - 'itemType', |
|
134 | - 'path', |
|
135 | - 'itemSource', |
|
136 | - 'permissions', |
|
137 | - ] |
|
138 | - ); |
|
139 | - } |
|
123 | + /** |
|
124 | + * Logs the updating of permission changes for shares |
|
125 | + * |
|
126 | + * @param array $params |
|
127 | + */ |
|
128 | + public function updatePermissions(array $params) { |
|
129 | + $this->log( |
|
130 | + 'The permissions of the shared %s "%s" with ID "%s" have been changed to "%s"', |
|
131 | + $params, |
|
132 | + [ |
|
133 | + 'itemType', |
|
134 | + 'path', |
|
135 | + 'itemSource', |
|
136 | + 'permissions', |
|
137 | + ] |
|
138 | + ); |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * Logs the password changes for a share |
|
143 | - * |
|
144 | - * @param array $params |
|
145 | - */ |
|
146 | - public function updatePassword(array $params) { |
|
147 | - $this->log( |
|
148 | - 'The password of the publicly shared %s "%s" with ID "%s" has been changed', |
|
149 | - $params, |
|
150 | - [ |
|
151 | - 'itemType', |
|
152 | - 'token', |
|
153 | - 'itemSource', |
|
154 | - ] |
|
155 | - ); |
|
156 | - } |
|
141 | + /** |
|
142 | + * Logs the password changes for a share |
|
143 | + * |
|
144 | + * @param array $params |
|
145 | + */ |
|
146 | + public function updatePassword(array $params) { |
|
147 | + $this->log( |
|
148 | + 'The password of the publicly shared %s "%s" with ID "%s" has been changed', |
|
149 | + $params, |
|
150 | + [ |
|
151 | + 'itemType', |
|
152 | + 'token', |
|
153 | + 'itemSource', |
|
154 | + ] |
|
155 | + ); |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Logs the expiration date changes for a share |
|
160 | - * |
|
161 | - * @param array $params |
|
162 | - */ |
|
163 | - public function updateExpirationDate(array $params) { |
|
164 | - $this->log( |
|
165 | - 'The expiration date of the publicly shared %s with ID "%s" has been changed to "%s"', |
|
166 | - $params, |
|
167 | - [ |
|
168 | - 'itemType', |
|
169 | - 'itemSource', |
|
170 | - 'date', |
|
171 | - ] |
|
172 | - ); |
|
173 | - } |
|
158 | + /** |
|
159 | + * Logs the expiration date changes for a share |
|
160 | + * |
|
161 | + * @param array $params |
|
162 | + */ |
|
163 | + public function updateExpirationDate(array $params) { |
|
164 | + $this->log( |
|
165 | + 'The expiration date of the publicly shared %s with ID "%s" has been changed to "%s"', |
|
166 | + $params, |
|
167 | + [ |
|
168 | + 'itemType', |
|
169 | + 'itemSource', |
|
170 | + 'date', |
|
171 | + ] |
|
172 | + ); |
|
173 | + } |
|
174 | 174 | |
175 | - /** |
|
176 | - * Logs access of shared files |
|
177 | - * |
|
178 | - * @param array $params |
|
179 | - */ |
|
180 | - public function shareAccessed(array $params) { |
|
181 | - $this->log( |
|
182 | - 'The shared %s with the token "%s" by "%s" has been accessed.', |
|
183 | - $params, |
|
184 | - [ |
|
185 | - 'itemType', |
|
186 | - 'token', |
|
187 | - 'uidOwner', |
|
188 | - ] |
|
189 | - ); |
|
190 | - } |
|
175 | + /** |
|
176 | + * Logs access of shared files |
|
177 | + * |
|
178 | + * @param array $params |
|
179 | + */ |
|
180 | + public function shareAccessed(array $params) { |
|
181 | + $this->log( |
|
182 | + 'The shared %s with the token "%s" by "%s" has been accessed.', |
|
183 | + $params, |
|
184 | + [ |
|
185 | + 'itemType', |
|
186 | + 'token', |
|
187 | + 'uidOwner', |
|
188 | + ] |
|
189 | + ); |
|
190 | + } |
|
191 | 191 | } |
@@ -27,16 +27,16 @@ |
||
27 | 27 | |
28 | 28 | class Trashbin extends Action { |
29 | 29 | |
30 | - public function delete($params) { |
|
31 | - $this->log('File "%s" deleted from trash bin.', |
|
32 | - ['path' => $params['path']], ['path'] |
|
33 | - ); |
|
34 | - } |
|
30 | + public function delete($params) { |
|
31 | + $this->log('File "%s" deleted from trash bin.', |
|
32 | + ['path' => $params['path']], ['path'] |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | - public function restore($params) { |
|
37 | - $this->log('File "%s" restored from trash bin.', |
|
38 | - ['path' => $params['filePath']], ['path'] |
|
39 | - ); |
|
40 | - } |
|
36 | + public function restore($params) { |
|
37 | + $this->log('File "%s" restored from trash bin.', |
|
38 | + ['path' => $params['filePath']], ['path'] |
|
39 | + ); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
@@ -35,22 +35,22 @@ |
||
35 | 35 | $versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source); |
36 | 36 | if( $versions ) { |
37 | 37 | |
38 | - $endReached = false; |
|
39 | - if (count($versions) <= $start+$count) { |
|
40 | - $endReached = true; |
|
41 | - } |
|
38 | + $endReached = false; |
|
39 | + if (count($versions) <= $start+$count) { |
|
40 | + $endReached = true; |
|
41 | + } |
|
42 | 42 | |
43 | - $versions = array_slice($versions, $start, $count); |
|
43 | + $versions = array_slice($versions, $start, $count); |
|
44 | 44 | |
45 | - // remove owner path from request to not disclose it to the recipient |
|
46 | - foreach ($versions as $version) { |
|
47 | - unset($version['path']); |
|
48 | - } |
|
45 | + // remove owner path from request to not disclose it to the recipient |
|
46 | + foreach ($versions as $version) { |
|
47 | + unset($version['path']); |
|
48 | + } |
|
49 | 49 | |
50 | - \OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached))); |
|
50 | + \OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached))); |
|
51 | 51 | |
52 | 52 | } else { |
53 | 53 | |
54 | - \OCP\JSON::success(array('data' => array('versions' => [], 'endReached' => true))); |
|
54 | + \OCP\JSON::success(array('data' => array('versions' => [], 'endReached' => true))); |
|
55 | 55 | |
56 | 56 | } |
@@ -34,8 +34,8 @@ |
||
34 | 34 | $revision=(int)$_GET['revision']; |
35 | 35 | |
36 | 36 | if(OCA\Files_Versions\Storage::rollback( $file, $revision )) { |
37 | - OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file ))); |
|
37 | + OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file ))); |
|
38 | 38 | }else{ |
39 | - $l = \OC::$server->getL10N('files_versions'); |
|
40 | - OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) )))); |
|
39 | + $l = \OC::$server->getL10N('files_versions'); |
|
40 | + OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) )))); |
|
41 | 41 | } |
@@ -27,24 +27,24 @@ |
||
27 | 27 | use OCA\Files_Versions\Expiration; |
28 | 28 | |
29 | 29 | class Application extends App { |
30 | - public function __construct(array $urlParams = array()) { |
|
31 | - parent::__construct('files_versions', $urlParams); |
|
30 | + public function __construct(array $urlParams = array()) { |
|
31 | + parent::__construct('files_versions', $urlParams); |
|
32 | 32 | |
33 | - $container = $this->getContainer(); |
|
33 | + $container = $this->getContainer(); |
|
34 | 34 | |
35 | - /* |
|
35 | + /* |
|
36 | 36 | * Register capabilities |
37 | 37 | */ |
38 | - $container->registerCapability('OCA\Files_Versions\Capabilities'); |
|
38 | + $container->registerCapability('OCA\Files_Versions\Capabilities'); |
|
39 | 39 | |
40 | - /* |
|
40 | + /* |
|
41 | 41 | * Register expiration |
42 | 42 | */ |
43 | - $container->registerService('Expiration', function($c) { |
|
44 | - return new Expiration( |
|
45 | - $c->query('ServerContainer')->getConfig(), |
|
46 | - $c->query('OCP\AppFramework\Utility\ITimeFactory') |
|
47 | - ); |
|
48 | - }); |
|
49 | - } |
|
43 | + $container->registerService('Expiration', function($c) { |
|
44 | + return new Expiration( |
|
45 | + $c->query('ServerContainer')->getConfig(), |
|
46 | + $c->query('OCP\AppFramework\Utility\ITimeFactory') |
|
47 | + ); |
|
48 | + }); |
|
49 | + } |
|
50 | 50 | } |