LogSettingsController.php 1.6 KB

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