|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Georg Ehrke <[email protected]> |
|
6
|
|
|
* @author Joas Schilling <[email protected]> |
|
7
|
|
|
* @author Lukas Reschke <[email protected]> |
|
8
|
|
|
* @author Morris Jobke <[email protected]> |
|
9
|
|
|
* @author Roeland Jago Douma <[email protected]> |
|
10
|
|
|
* @author Thomas Müller <[email protected]> |
|
11
|
|
|
* |
|
12
|
|
|
* @license AGPL-3.0 |
|
13
|
|
|
* |
|
14
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
15
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
16
|
|
|
* as published by the Free Software Foundation. |
|
17
|
|
|
* |
|
18
|
|
|
* This program is distributed in the hope that it will be useful, |
|
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21
|
|
|
* GNU Affero General Public License for more details. |
|
22
|
|
|
* |
|
23
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
24
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
25
|
|
|
* |
|
26
|
|
|
*/ |
|
27
|
|
|
|
|
28
|
|
|
namespace OC\Settings\Controller; |
|
29
|
|
|
|
|
30
|
|
|
use OCP\AppFramework\Controller; |
|
31
|
|
|
use OCP\AppFramework\Http; |
|
32
|
|
|
use OCP\AppFramework\Http\JSONResponse; |
|
33
|
|
|
use OCP\AppFramework\Http\StreamResponse; |
|
34
|
|
|
use OCP\IL10N; |
|
35
|
|
|
use OCP\IRequest; |
|
36
|
|
|
use OCP\IConfig; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Class LogSettingsController |
|
40
|
|
|
* |
|
41
|
|
|
* @package OC\Settings\Controller |
|
42
|
|
|
*/ |
|
43
|
|
|
class LogSettingsController extends Controller { |
|
44
|
|
|
/** |
|
45
|
|
|
* download logfile |
|
46
|
|
|
* |
|
47
|
|
|
* @NoCSRFRequired |
|
48
|
|
|
* |
|
49
|
|
|
* @return StreamResponse |
|
50
|
|
|
*/ |
|
51
|
|
|
public function download() { |
|
52
|
|
|
$resp = new StreamResponse(\OC\Log\File::getLogFilePath()); |
|
53
|
|
|
$resp->addHeader('Content-Type', 'application/octet-stream'); |
|
54
|
|
|
$resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"'); |
|
55
|
|
|
return $resp; |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|