LogSettingsController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Georg Ehrke <georg@owncloud.com>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  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. namespace OC\Settings\Controller;
  28. use OCP\AppFramework\Controller;
  29. use OCP\AppFramework\Http;
  30. use OCP\AppFramework\Http\JSONResponse;
  31. use OCP\AppFramework\Http\StreamResponse;
  32. use OCP\IL10N;
  33. use OCP\IRequest;
  34. use OCP\IConfig;
  35. /**
  36. * Class LogSettingsController
  37. *
  38. * @package OC\Settings\Controller
  39. */
  40. class LogSettingsController extends Controller {
  41. /**
  42. * download logfile
  43. *
  44. * @NoCSRFRequired
  45. *
  46. * @return StreamResponse
  47. */
  48. public function download() {
  49. $resp = new StreamResponse(\OC\Log\File::getLogFilePath());
  50. $resp->addHeader('Content-Type', 'application/octet-stream');
  51. $resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"');
  52. return $resp;
  53. }
  54. }