Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set MySQLPDODatabase as default database class in installer #6230

Closed
wants to merge 1 commit into from
Closed

Set MySQLPDODatabase as default database class in installer #6230

wants to merge 1 commit into from

Conversation

SpiritLevel
Copy link
Contributor

No description provided.

@@ -152,7 +152,7 @@ if(isset($_REQUEST['db'])) {
$databaseConfig['type'] = $type;
}
} else {
$type = $_REQUEST['db']['type'] = defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : 'MySQLDatabase';
$type = $_REQUEST['db']['type'] = defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : 'MySQLPDODatabase';
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is hard to read isn't it?

I wonder if we could automatically guess default connector based on dependency detection; It could be safer to fall back to mysqldatabase if the pdo_mysql driver isn't installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, hard to read :) And the installer is quite lengthy at 1700+ lines! I wonder if it should be broken into pieces, each dealing with only one aspect of the installation ?

It would be good to encourage pdo but fall back to the more common mysqli...how's about detecting pdo with:

extension_loaded('PDO') && extension_loaded('pdo_mysql')

Here are more options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sminnee
Copy link
Member

sminnee commented Nov 1, 2016

This makes sense to me, as would picking an alternative database driver if PDO wasn't available.

Do you want to make that change? I'd recommended doing it based on the DatabaseAdapterRegistry supported values rather than repeating the check.

@SpiritLevel
Copy link
Contributor Author

OK, I'll have a go at it... :)

@SpiritLevel
Copy link
Contributor Author

Closing. PR submitted here: #6274.

@SpiritLevel SpiritLevel closed this Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants