Local example

    $test_authorize = FALSE;
    if (drupal_valid_test_ua()) {
      $test_authorize = \Drupal::state()->get('test_uploaders_via_prompt', FALSE);
    }
    // If the owner of the directory we extracted is the same as the owner of     // our configuration directory (e.g. sites/default) where we're trying to     // install the code, there's no need to prompt for FTP/SSH credentials.     // Instead, we instantiate a Drupal\Core\FileTransfer\Local and invoke     // update_authorize_run_install() directly.     if (fileowner($project_real_location) == fileowner($this->sitePath) && !$test_authorize) {
      $this->moduleHandler->loadInclude('update', 'inc', 'update.authorize');
      $filetransfer = new Local($this->root, \Drupal::service('file_system'));
      $response = call_user_func_array('update_authorize_run_install', array_merge([$filetransfer]$arguments));
      if ($response instanceof Response) {
        $form_state->setResponse($response);
      }
    }

    // Otherwise, go through the regular workflow to prompt for FTP/SSH     // credentials and invoke update_authorize_run_install() indirectly with     // whatever FileTransfer object authorize.php creates for us.     else {
      // The page title must be passed here to ensure it is initially used when
/** * {@inheritdoc} */
  public function connect() {
    // No-op   }

  /** * {@inheritdoc} */
  public static function factory($jail$settings) {
    return new Local($jail, \Drupal::service('file_system'));
  }

  /** * {@inheritdoc} */
  protected function copyFileJailed($source$destination) {
    if (@!copy($source$destination)) {
      throw new FileTransferException('Cannot copy %source to %destination.', 0, ['%source' => $source, '%destination' => $destination]);
    }
  }

  
'local_url' => $project_real_location,
        ];
      }

      // If the owner of the last directory we extracted is the same as the       // owner of our configuration directory (e.g. sites/default) where we're       // trying to install the code, there's no need to prompt for FTP/SSH       // credentials. Instead, we instantiate a Drupal\Core\FileTransfer\Local       // and invoke update_authorize_run_update() directly.       if (fileowner($project_real_location) == fileowner($this->sitePath)) {
        $this->moduleHandler->loadInclude('update', 'inc', 'update.authorize');
        $filetransfer = new Local($this->root, \Drupal::service('file_system'));
        $response = update_authorize_run_update($filetransfer$updates);
        if ($response instanceof Response) {
          $form_state->setResponse($response);
        }
      }
      // Otherwise, go through the regular workflow to prompt for FTP/SSH       // credentials and invoke update_authorize_run_update() indirectly with       // whatever FileTransfer object authorize.php creates for us.       else {
        // The page title must be passed here to ensure it is initially used         // when authorize.php loads for the first time with the FTP/SSH
Home | Imprint | This part of the site doesn't use cookies.