Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions installation/language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ INSTL_DATABASE_NAME_LABEL="Database Name"
INSTL_DATABASE_NO_SCHEMA="No database schema exists for this database type."
INSTL_DATABASE_PASSWORD_DESC="Either a password you created or a password provided by your host."
INSTL_DATABASE_PREFIX_DESC="Enter a table prefix or use the randomly generated one."
INSTL_DATABASE_PREFIX_MSG="The table prefix must start with a letter, optionally be followed by alphanumeric characters and by an underscore"
INSTL_DATABASE_TYPE_DESC="Select the database type."
INSTL_DATABASE_USER_DESC="Either a username you created or a username provided by your host."
INSTL_DATABASE_VALIDATION_ERROR="Check your database credentials, database type, database name or hostname"
Expand Down
1 change: 1 addition & 0 deletions installation/language/en-US/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ INSTL_DATABASE_INVALID_NAME="MySQL versions previous to 5.1.6 may not contain pe
INSTL_DATABASE_NAME_INVALID_SPACES="MySQL database names and table names may not begin or end with spaces."
INSTL_DATABASE_NAME_INVALID_CHAR="No MySQL identifier can contain a NULL ASCII(0x00)."
INSTL_DATABASE_FILE_DOES_NOT_EXIST="File %s does not exist"
INSTL_DATABASE_PREFIX_MSG="The table prefix must start with a letter, optionally be followed by alphanumeric characters and by an underscore"
INSTL_DATABASE_VALIDATION_ERROR="Check your database credentials, database type, database name or hostname"

;controllers
Expand Down
11 changes: 8 additions & 3 deletions installation/src/Controller/InstallationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ public function dbcheck()
// Check the form
/** @var \Joomla\CMS\Installation\Model\SetupModel $model */
$model = $this->getModel('Setup');
if ($model->checkForm('setup') === false || $model->validateDbConnection() === false)
if ($model->checkForm('setup') === false)
{
$r->messages = Text::_('INSTL_DATABASE_VALIDATION_ERROR');
$r->view = 'setup';
$this->app->enqueueMessage(Text::_('INSTL_DATABASE_VALIDATION_ERROR'), 'error');
$r->validated = false;
$this->sendJsonResponse($r);

return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add blank line above return;

}

$r->validated = $model->validateDbConnection();

$this->sendJsonResponse($r);
}

Expand Down
17 changes: 8 additions & 9 deletions installation/template/js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,16 @@ Joomla.checkDbCredentials = function() {
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
onSuccess: function(response, xhr){
response = JSON.parse(response);
Joomla.loadingLayer('hide');
if (response.messages) {
Joomla.renderMessages(response.messages);
}

Joomla.replaceTokens(response.token);
if (response.data.messages) {
Joomla.loadingLayer('hide');
Joomla.renderMessages({
"error": [response.data.messages]
});
// You shall not pass, DB credentials error!!!!
} else {
Joomla.loadingLayer('hide');
Joomla.loadingLayer("hide");

if (response.error) {
Joomla.renderMessages({'error': [response.message]});
} else if (response.data && response.data.validated === true) {
// Run the installer - we let this handle the redirect for now
// TODO: Convert to promises
Joomla.install(['config'], form);
Expand Down