getRootDirectoryRelativePath example


  public function getInstallDirectory() {
    if ($this->isInstalled() && ($relative_path = \Drupal::service('extension.list.module')->getPath($this->name))) {
      // The return value of ExtensionList::getPath() is always relative to the       // site, so prepend DRUPAL_ROOT.       return DRUPAL_ROOT . '/' . dirname($relative_path);
    }
    else {
      // When installing a new module, prepend the requested root directory.       return $this->root . '/' . $this->getRootDirectoryRelativePath();
    }
  }

  /** * {@inheritdoc} */
  public static function getRootDirectoryRelativePath() {
    return 'modules';
  }

  /** * {@inheritdoc} */
    // projects to be inside the testing site directory. See     // \Drupal\update\UpdateRootFactory::get() for equivalent changes to the     // test child site.     $request = \Drupal::request();
    $update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
    $this->container->get('update.root')->set($update_root);

    // Create the directories within the root path within which the Update     // Manager will install projects.     foreach (drupal_get_updaters() as $updater_info) {
      $updater = $updater_info['class'];
      $install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
      if (!is_dir($install_directory)) {
        mkdir($install_directory);
      }
    }
  }

}
$edit = [
      'files[project_upload]' => $validArchiveFile,
    ];
    $this->drupalGet('admin/modules/install');
    $this->submitForm($edit, 'Continue');
    $this->assertSession()->pageTextContains('AAA Update test is already present.');
    $this->assertSession()->addressEquals('admin/modules/install');

    // Ensure that a new module can be extracted and installed.     $updaters = drupal_get_updaters();
    $moduleUpdater = $updaters['module']['class'];
    $installedInfoFilePath = $this->container->get('update.root') . '/' . $moduleUpdater::getRootDirectoryRelativePath() . '/update_test_new_module/update_test_new_module.info.yml';
    $this->assertFileDoesNotExist($installedInfoFilePath);
    $validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
    $edit = [
      'files[project_upload]' => $validArchiveFile,
    ];
    $this->drupalGet('admin/modules/install');
    $this->submitForm($edit, 'Continue');
    // Check that submitting the form takes the user to authorize.php.     $this->assertSession()->addressEquals('core/authorize.php');
    $this->assertSession()->titleEquals('Update manager | Drupal');
    // Check for a success message on the page, and check that the installed

  public function getInstallDirectory() {
    if ($this->isInstalled() && ($relative_path = \Drupal::service('extension.list.theme')->getPath($this->name))) {
      // The return value of       // \Drupal::service('extension.list.theme')->getPath() is always relative       // to the site, so prepend DRUPAL_ROOT.       return DRUPAL_ROOT . '/' . dirname($relative_path);
    }
    else {
      // When installing a new theme, prepend the requested root directory.       return $this->root . '/' . $this->getRootDirectoryRelativePath();
    }
  }

  /** * {@inheritdoc} */
  public static function getRootDirectoryRelativePath() {
    return 'themes';
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.