diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-04-24 22:14:00 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-04-26 12:00:06 +0200 |
commit | 5fbf184134f34633bc150b2e0210c4a97ec285a9 (patch) | |
tree | bdc4d79196f1268cf8d5df488c9b31705ceb82a0 /settings | |
parent | b7e8ab97e731b77ef2ec519bfb98019516b7f682 (diff) | |
download | nextcloud-server-5fbf184134f34633bc150b2e0210c4a97ec285a9.tar.gz nextcloud-server-5fbf184134f34633bc150b2e0210c4a97ec285a9.zip |
destaticfy Log classes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/LogSettingsController.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/settings/Controller/LogSettingsController.php b/settings/Controller/LogSettingsController.php index 6405ff9ec73..3b2479b602a 100644 --- a/settings/Controller/LogSettingsController.php +++ b/settings/Controller/LogSettingsController.php @@ -26,8 +26,11 @@ namespace OC\Settings\Controller; +use OC\Log; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\StreamResponse; +use OCP\ILogger; +use OCP\IRequest; /** * Class LogSettingsController @@ -35,6 +38,15 @@ use OCP\AppFramework\Http\StreamResponse; * @package OC\Settings\Controller */ class LogSettingsController extends Controller { + + /** @var Log */ + private $log; + + public function __construct(string $appName, IRequest $request, ILogger $logger) { + parent::__construct($appName, $request); + $this->log = $logger; + } + /** * download logfile * @@ -43,7 +55,10 @@ class LogSettingsController extends Controller { * @return StreamResponse */ public function download() { - $resp = new StreamResponse(\OC\Log\File::getLogFilePath()); + if(!$this->log instanceof Log) { + throw new \UnexpectedValueException('Log file not available'); + } + $resp = new StreamResponse($this->log->getLogPath()); $resp->addHeader('Content-Type', 'application/octet-stream'); $resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"'); return $resp; |