/** * Execute Command. * * @param InputInterface $consoleInput * @param OutputInterface $consoleOutput * * @throws PathNotFoundException * @throws \Exception * @throws \kriskbx\wyn\Exceptions\PropertyNotSetException * * @return int|null|void */ public function execute(InputInterface $consoleInput, OutputInterface $consoleOutput) { parent::execute($consoleInput, $consoleOutput); // Create Config $config = new YamlConfig(new Yaml(), $consoleInput->getArgument('config')); // Create console output logger $console = $this->createConsoleOutput($this); // Set empty cron object $cron = null; // Loop through all inputs foreach ($config->getAllInputs() as $inputName) { if (!isset($config->getInput($inputName)['to']) || !isset($config->getInput($inputName)['cron'])) { continue; } // Create settings and set timezone before the actual backup $settings = $this->createSettings($inputName, $this->getOutputNames($consoleInput, $config, $inputName)[0], $consoleInput, $config); $this->setTimezone($settings); // Create cron object if it isn't already set $this->assertCron($cron, $settings); // Assert that the job is added to the cron object and up-to-date $this->assertJob($config, $inputName, $cron); // Start the backup if the job should run if ($cron->get($inputName)->shouldRun()) { $cron->started($inputName); $this->backup($inputName, $consoleInput, $consoleOutput, $config, $console); } } // Display the Finished Message $this->finished($consoleOutput); }
/** * Execute Command. * * @param InputInterface $consoleInput * @param OutputInterface $consoleOutput * * @throws PathNotFoundException * @throws \Exception * @throws \kriskbx\wyn\Exceptions\PropertyNotSetException * * @return int|null|void */ public function execute(InputInterface $consoleInput, OutputInterface $consoleOutput) { parent::execute($consoleInput, $consoleOutput); // Create config $config = new YamlConfig(new Yaml(), $consoleInput->getArgument('config')); // Create console output logger $console = $this->createConsoleOutput($this); // Loop through all inputs foreach ($config->getAllInputs() as $inputName) { if (!isset($config->getInput($inputName)['to'])) { continue; } $this->backup($inputName, $consoleInput, $consoleOutput, $config, $console); } // Display the Finished Message $this->finished($consoleOutput); }