コード例 #1
0
 /**
  * acquia_connector.migrate_check route callback for checking client upload.
  */
 public function migrateCheck()
 {
     $return = array('compatible' => TRUE);
     $migrate = new Migration();
     $env = $migrate->checkEnv();
     if (empty($env) || $env['error'] !== FALSE) {
         $return['compatible'] = FALSE;
         $return['message'] = $env['error'];
     }
     return new JsonResponse($return);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $values = $form_state->getValues();
     // Sanity check.
     if (empty($values['envs'])) {
         return;
     }
     $migrate_files = isset($values['migrate_files']) ? $values['migrate_files'] : TRUE;
     $this->config('acquia_connector.settings')->set('migrate.files', $migrate_files)->save();
     $reduce_db_size = !empty($values['reduce_db_size']) ? $values['reduce_db_size'] : FALSE;
     if (count($values['envs']) > 1) {
         // Use selected environment.
         $env = $values['envs'][$values['environment']];
         $site_name = $values['environment'];
     } else {
         $env = array_pop($values['envs']);
         $site_name = $env;
     }
     // Prepare for migration.
     $migration_class = new Migration();
     $migration = $migration_class->prepare($env);
     $migration['site_name'] = $site_name;
     if ($reduce_db_size) {
         $migration['no_data_tables'] = array('cachetags', 'cache_bootstrap', 'cache_config', 'cache_data', 'cache_default', 'cache_discovery', 'cache_entity', 'cache_menu', 'cache_render', 'cache_toolbar', 'sessions', 'watchdog');
     }
     if (isset($migration['error']) && $migration['error'] !== FALSE) {
         drupal_set_message($this->t('Unable to begin migration. @error', array('@error' => $migration['error'])), 'error');
         $form_state->setRedirect('acquia_connector.settings');
     } else {
         $batch = array('title' => $this->t('Acquia Cloud Migrate'), 'operations' => array(array(array($migration_class, 'batchTest'), array($migration)), array(array($migration_class, 'batchDb'), array($migration)), array(array($migration_class, 'batchTar'), array($migration)), array(array($migration_class, 'batchTransmit'), array($migration))), 'init_message' => $this->t('Preparing for migration'), 'progress_message' => $this->t('Completed @current of @total steps.'), 'finished' => array($migration_class, 'batchFinished'));
         batch_set($batch);
     }
 }
コード例 #3
0
 /**
  * @param $form
  * @param $form_state
  */
 public function submitMigrateCleanupForm($form, FormStateInterface &$form_state)
 {
     $migration = $this->config('acquia_connector.settings')->get('cloud_migration');
     $migration_class = new Migration();
     $migration_class->cleanup($migration);
     drupal_set_message($this->t('Temporary files removed'));
     $form_state->setRedirect('acquia_connector.settings');
 }