CheckCore.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Carla Schroder <carla@owncloud.com>
  6. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OC\Core\Command\Integrity;
  24. use OC\IntegrityCheck\Checker;
  25. use OC\Core\Command\Base;
  26. use Symfony\Component\Console\Input\InputInterface;
  27. use Symfony\Component\Console\Output\OutputInterface;
  28. /**
  29. * Class CheckCore
  30. *
  31. * @package OC\Core\Command\Integrity
  32. */
  33. class CheckCore extends Base {
  34. /**
  35. * @var Checker
  36. */
  37. private $checker;
  38. public function __construct(Checker $checker) {
  39. parent::__construct();
  40. $this->checker = $checker;
  41. }
  42. /**
  43. * {@inheritdoc }
  44. */
  45. protected function configure() {
  46. parent::configure();
  47. $this
  48. ->setName('integrity:check-core')
  49. ->setDescription('Check integrity of core code using a signature.');
  50. }
  51. /**
  52. * {@inheritdoc }
  53. */
  54. protected function execute(InputInterface $input, OutputInterface $output) {
  55. $result = $this->checker->verifyCoreSignature();
  56. $this->writeArrayInOutputFormat($input, $output, $result);
  57. if (count($result)>0){
  58. return 1;
  59. }
  60. }
  61. }