You are here

private static function EvaluationImplementation::upgradeCheckJsonFormSubmitAutomatic in Drupal 8 upgrade evaluation 6

Same name and namespace in other branches
  1. 7 includes/EvaluationImplementation.php \Upgrade_check\EvaluationImplementation::upgradeCheckJsonFormSubmitAutomatic()

Implements upgradeCheckJsonFormSubmitAutomatic().

1 call to EvaluationImplementation::upgradeCheckJsonFormSubmitAutomatic()
EvaluationImplementation::upgradeCheckJsonFormSubmit in includes/EvaluationImplementation.php
Implements _upgrade_check_json_form_submit().

File

includes/EvaluationImplementation.php, line 761

Class

EvaluationImplementation

Namespace

Upgrade_check

Code

private static function upgradeCheckJsonFormSubmitAutomatic() {
  $filePath = variable_get(self::UPGRADE_CHECK_JSON_PATH, NULL);
  $file = file_get_contents($filePath);
  if (!empty($file)) {
    global $user;
    $password = user_password(self::PASSWORD_LENGTH);
    if (!empty($user->mail) && !empty($password)) {
      preg_match(self::REG_NAME, $user->mail, $name);
      $data = array(
        'name' => $name[0],
        'mail' => $user->mail,
        'pass' => $password,
        'data' => $file,
      );
      $result = self::upgradeCheckCheckResultRest(self::upgradeCheckCurl($data));
      if (!empty($result)) {
        $string = array(
          'name' => $name[0],
          'pass' => $password,
        );
        $result = self::upgradeCheckCryptUserData($string);
        if (!empty($result)) {
          file_delete(variable_get(self::UPGRADE_CHECK_JSON_PATH, NULL));
          variable_del(self::UPGRADE_CHECK_JSON_PATH);
          drupal_set_message(t('The data is successfully sent.'));
          drupal_goto(UPGRADE_CHECK_RESULT);
        }
      }
    }
  }
  return FALSE;
}