Loading core/lib/Drupal/Core/Database/Install/Tasks.php +39 −17 Original line number Diff line number Diff line Loading @@ -82,41 +82,50 @@ abstract class Tasks { /** * Ensure the PDO driver is supported by the version of PHP in use. * * @return bool * TRUE if the PDO driver is supported, otherwise FALSE. */ protected function hasPdoDriver() { return in_array($this->pdoDriver, \PDO::getAvailableDrivers()); } /** * Assert test as failed. * Asserts test as failed. */ protected function fail($message) { $this->results['fail'][] = $message; } /** * Assert test as a pass. * Asserts test as a pass. */ protected function pass($message) { $this->results['pass'][] = $message; } /** * Check whether Drupal is installable on the database. * Checks whether Drupal is installable on the database. * * @return bool * TRUE if Drupal can be installed on the database, otherwise FALSE. */ public function installable() { return $this->hasPdoDriver() && empty($this->error); } /** * Return the human-readable name of the driver. * Returns the human-readable name of the driver. * * @return string * The human-readable name of the driver. */ abstract public function name(); /** * Return the minimum required version of the engine. * Returns the minimum required version of the engine. * * @return * @return string|null * A version string. If not NULL, it will be checked against the version * reported by the Database engine using version_compare(). */ Loading @@ -125,9 +134,9 @@ public function minimumVersion() { } /** * Run database tasks and tests to see if Drupal can run on the database. * Runs database tasks and tests to see if Drupal can run on the database. * * @return array * @return string[] * A list of error messages. */ public function runTasks() { Loading Loading @@ -165,7 +174,10 @@ final public function engineVersionRequirementsCheck() { } /** * Check if we can connect to the database. * Checks if we can connect to the database. * * @return bool * TRUE if we can connect to the database, otherwise FALSE. */ protected function connect() { try { Loading @@ -183,7 +195,7 @@ protected function connect() { } /** * Run SQL tests to ensure the database can execute commands with the current user. * Ensures the database can execute commands with the current user. */ protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) { try { Loading @@ -197,7 +209,7 @@ protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) { } /** * Check the engine version. * Checks the engine version. */ protected function checkEngineVersion() { // Ensure that the database server has the right version. Loading @@ -222,12 +234,12 @@ protected function checkEngineVersion() { } /** * Return driver specific configuration options. * Returns driver specific configuration options. * * @param $database * @param string[] $database * An array of driver specific configuration options. * * @return * @return array * The options form array. */ public function getFormOptions(array $database) { Loading Loading @@ -319,13 +331,13 @@ public function getFormOptions(array $database) { * Checks to ensure correct basic database settings and that a proper * connection to the database can be established. * * @param $database * @param string[] $database * An array of driver specific configuration options. * * @return * @return \Drupal\Core\StringTranslation\TranslatableMarkup[] * An array of driver configuration errors, keyed by form element name. */ public function validateDatabaseSettings($database) { public function validateDatabaseSettings(array $database) { $errors = []; // Verify the table prefix. Loading @@ -339,6 +351,16 @@ public function validateDatabaseSettings($database) { /** * Translates a string to the current language or to a given language. * * @param string $string * The string literal to translate. * @param array $args * Placeholder arguments to use inside the translated string (if any). * @param array $options * Options for the translation. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * An object representing the translatable markup for the given string. * * @see \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() */ protected function t($string, array $args = [], array $options = []) { Loading Loading
core/lib/Drupal/Core/Database/Install/Tasks.php +39 −17 Original line number Diff line number Diff line Loading @@ -82,41 +82,50 @@ abstract class Tasks { /** * Ensure the PDO driver is supported by the version of PHP in use. * * @return bool * TRUE if the PDO driver is supported, otherwise FALSE. */ protected function hasPdoDriver() { return in_array($this->pdoDriver, \PDO::getAvailableDrivers()); } /** * Assert test as failed. * Asserts test as failed. */ protected function fail($message) { $this->results['fail'][] = $message; } /** * Assert test as a pass. * Asserts test as a pass. */ protected function pass($message) { $this->results['pass'][] = $message; } /** * Check whether Drupal is installable on the database. * Checks whether Drupal is installable on the database. * * @return bool * TRUE if Drupal can be installed on the database, otherwise FALSE. */ public function installable() { return $this->hasPdoDriver() && empty($this->error); } /** * Return the human-readable name of the driver. * Returns the human-readable name of the driver. * * @return string * The human-readable name of the driver. */ abstract public function name(); /** * Return the minimum required version of the engine. * Returns the minimum required version of the engine. * * @return * @return string|null * A version string. If not NULL, it will be checked against the version * reported by the Database engine using version_compare(). */ Loading @@ -125,9 +134,9 @@ public function minimumVersion() { } /** * Run database tasks and tests to see if Drupal can run on the database. * Runs database tasks and tests to see if Drupal can run on the database. * * @return array * @return string[] * A list of error messages. */ public function runTasks() { Loading Loading @@ -165,7 +174,10 @@ final public function engineVersionRequirementsCheck() { } /** * Check if we can connect to the database. * Checks if we can connect to the database. * * @return bool * TRUE if we can connect to the database, otherwise FALSE. */ protected function connect() { try { Loading @@ -183,7 +195,7 @@ protected function connect() { } /** * Run SQL tests to ensure the database can execute commands with the current user. * Ensures the database can execute commands with the current user. */ protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) { try { Loading @@ -197,7 +209,7 @@ protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) { } /** * Check the engine version. * Checks the engine version. */ protected function checkEngineVersion() { // Ensure that the database server has the right version. Loading @@ -222,12 +234,12 @@ protected function checkEngineVersion() { } /** * Return driver specific configuration options. * Returns driver specific configuration options. * * @param $database * @param string[] $database * An array of driver specific configuration options. * * @return * @return array * The options form array. */ public function getFormOptions(array $database) { Loading Loading @@ -319,13 +331,13 @@ public function getFormOptions(array $database) { * Checks to ensure correct basic database settings and that a proper * connection to the database can be established. * * @param $database * @param string[] $database * An array of driver specific configuration options. * * @return * @return \Drupal\Core\StringTranslation\TranslatableMarkup[] * An array of driver configuration errors, keyed by form element name. */ public function validateDatabaseSettings($database) { public function validateDatabaseSettings(array $database) { $errors = []; // Verify the table prefix. Loading @@ -339,6 +351,16 @@ public function validateDatabaseSettings($database) { /** * Translates a string to the current language or to a given language. * * @param string $string * The string literal to translate. * @param array $args * Placeholder arguments to use inside the translated string (if any). * @param array $options * Options for the translation. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * An object representing the translatable markup for the given string. * * @see \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() */ protected function t($string, array $args = [], array $options = []) { Loading