1
0

SimpleOutput.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017, ownCloud GmbH
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. *
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OC\Migration;
  23. use OCP\ILogger;
  24. use OCP\Migration\IOutput;
  25. /**
  26. * Class SimpleOutput
  27. *
  28. * Just a simple IOutput implementation with writes messages to the log file.
  29. * Alternative implementations will write to the console or to the web ui (web update case)
  30. *
  31. * @package OC\Migration
  32. */
  33. class SimpleOutput implements IOutput {
  34. /** @var ILogger */
  35. private $logger;
  36. private $appName;
  37. public function __construct(ILogger $logger, $appName) {
  38. $this->logger = $logger;
  39. $this->appName = $appName;
  40. }
  41. /**
  42. * @param string $message
  43. * @since 9.1.0
  44. */
  45. public function info($message) {
  46. $this->logger->info($message, ['app' => $this->appName]);
  47. }
  48. /**
  49. * @param string $message
  50. * @since 9.1.0
  51. */
  52. public function warning($message) {
  53. $this->logger->warning($message, ['app' => $this->appName]);
  54. }
  55. /**
  56. * @param int $max
  57. * @since 9.1.0
  58. */
  59. public function startProgress($max = 0) {
  60. }
  61. /**
  62. * @param int $step
  63. * @param string $description
  64. * @since 9.1.0
  65. */
  66. public function advance($step = 1, $description = '') {
  67. }
  68. /**
  69. * @since 9.1.0
  70. */
  71. public function finishProgress() {
  72. }
  73. }