Completed
Pull Request — master (#2214)
by Robin
14:15 queued 05:55
created

LogSettingsController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 4
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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