/** * Execute the console command. * * @throws \Exception * @return bool */ protected function backup() { $configuration = $this->createConfiguration(); // add a printer for some output // FIXME: Printer parent::__construct() call is invalid // $configuration->addLogger($this->createPrinter()); // finally execute the backup $result = $this->runner->run($configuration); return $result->wasSuccessful(); }
/** * Execute the console command. * * @return boolean */ public function fire() { // Create a backup configuration $configuration = $this->createConfiguration(); // Back up! $result = $this->runner->run($configuration); // Result handling return $result->wasSuccessful(); }
/** * Runs the application. * * @param array $args */ public function run(array $args) { $this->isPhar = defined('__PHPBU_PHAR__'); $this->handleOpt($args); $this->findConfiguration(); $ret = self::EXIT_FAILURE; $runner = new Runner(new Factory()); try { $result = $runner->run($this->createConfiguration()); if ($result->wasSuccessful()) { $ret = self::EXIT_SUCCESS; } elseif ($result->errorCount() > 0) { $ret = self::EXIT_EXCEPTION; } } catch (\Exception $e) { echo $e->getMessage() . PHP_EOL; $ret = self::EXIT_EXCEPTION; } exit($ret); }