Esempio n. 1
0
 /**
  * Backup task
  */
 protected function runMain()
 {
     // ##################
     // Option specific runners
     // ##################
     $runRsync = true;
     $runMysql = true;
     if ($this->input->getOption('mysql') || $this->input->getOption('rsync')) {
         // don't run rsync if not specifiecd
         $runRsync = $this->input->getOption('rsync');
         // don't run mysql if not specifiecd
         $runMysql = $this->input->getOption('mysql');
     }
     // ##################
     // Run tasks
     // ##################
     // Check database connection
     if ($runMysql && $this->contextConfig->exists('mysql')) {
         DatabaseConnection::ping();
     }
     // Sync files with rsync to local storage
     if ($runRsync && $this->contextConfig->exists('rsync')) {
         $this->output->writeln('<h1>Starting FILE sync</h1>');
         $this->runTaskRsync();
     }
     // Sync database to local server
     if ($runMysql && $this->contextConfig->exists('mysql')) {
         $this->output->writeln('<h1>Starting MYSQL sync</h1>');
         $this->runTaskDatabase();
     }
 }