JobMaintenanceMode.php 888 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © 2013-2017 Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Update\Queue;
  7. /**
  8. * Magento maintenance mode job
  9. */
  10. class JobMaintenanceMode extends AbstractJob
  11. {
  12. /**
  13. * @param string $name
  14. * @param array $params
  15. * @param \Magento\Update\Status|null $status
  16. */
  17. public function __construct(
  18. $name,
  19. $params,
  20. \Magento\Update\Status $status = null
  21. ) {
  22. parent::__construct($name, $params, $status);
  23. }
  24. /**
  25. * @return $this
  26. */
  27. public function execute()
  28. {
  29. try {
  30. if ($this->params['enable'] == true) {
  31. $this->maintenanceMode->set(true);
  32. } else {
  33. $this->maintenanceMode->set(false);
  34. }
  35. } catch (\Exception $e) {
  36. }
  37. return $this;
  38. }
  39. }