AlreadyInstalledException.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\Core\Installer\Exception;
  3. use Drupal\Core\StringTranslation\TranslationInterface;
  4. /**
  5. * Exception thrown if Drupal is installed already.
  6. */
  7. class AlreadyInstalledException extends InstallerException {
  8. /**
  9. * Constructs a new "already installed" exception.
  10. *
  11. * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
  12. * The string translation manager.
  13. */
  14. public function __construct(TranslationInterface $string_translation) {
  15. $this->stringTranslation = $string_translation;
  16. $title = $this->t('Drupal already installed');
  17. $message = $this->t('<ul>
  18. <li>To start over, you must empty your existing database and copy <em>default.settings.php</em> over <em>settings.php</em>.</li>
  19. <li>To upgrade an existing installation, proceed to the <a href=":update-url">update script</a>.</li>
  20. <li>View your <a href=":base-url">existing site</a>.</li>
  21. </ul>', [
  22. ':base-url' => $GLOBALS['base_url'],
  23. ':update-url' => $GLOBALS['base_path'] . 'update.php',
  24. ]);
  25. parent::__construct($message, $title);
  26. }
  27. }