Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Installer/Exception/AlreadyInstalledException.php \Drupal\Core\Installer\Exception\AlreadyInstalledException
  2. 9 core/lib/Drupal/Core/Installer/Exception/AlreadyInstalledException.php \Drupal\Core\Installer\Exception\AlreadyInstalledException

Exception thrown if Drupal is installed already.

Hierarchy

Expanded class hierarchy of AlreadyInstalledException

File

core/lib/Drupal/Core/Installer/Exception/AlreadyInstalledException.php, line 10

Namespace

Drupal\Core\Installer\Exception
View source
class AlreadyInstalledException extends InstallerException {

  /**
   * Constructs a new "already installed" exception.
   *
   * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
   *   The string translation manager.
   */
  public function __construct(TranslationInterface $string_translation) {
    $this->stringTranslation = $string_translation;
    $title = $this
      ->t('Drupal already installed');
    $replacements = [
      ':base-url' => $GLOBALS['base_url'],
      // We cannot use the route system.db_update here because we are too early
      // in the execution stack.
      ':update-url' => $GLOBALS['base_path'] . 'update.php',
    ];
    $message = $this
      ->t('<ul>
<li>To start over, you must empty your existing database and copy <em>default.settings.php</em> over <em>settings.php</em>.</li>
<li>To upgrade an existing installation, proceed to the <a href=":update-url">update script</a>.</li>
<li>View your <a href=":base-url">existing site</a>.</li>
</ul>', $replacements);
    parent::__construct($message, $title);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AlreadyInstalledException::__construct public function Constructs a new "already installed" exception. Overrides InstallerException::__construct
InstallerException::$title protected property The page title to output.
InstallerException::getTitle public function Returns the exception page title.
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 1
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.