mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6274 from SpiritLevel/PDO-as-default-in-webinstaller
Setting default db adapter in installation as PDO MySQL
This commit is contained in:
commit
857caa8fff
@ -1,26 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Register the SilverStripe provided databases
|
// Register database adapters available in SilverStripe
|
||||||
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
use SilverStripe\Dev\Install\DatabaseAdapterRegistry;
|
||||||
use SilverStripe\Dev\Install\MySQLDatabaseConfigurationHelper;
|
use SilverStripe\Dev\Install\MySQLDatabaseConfigurationHelper;
|
||||||
|
|
||||||
// Use MySQLi as default
|
|
||||||
DatabaseAdapterRegistry::register(
|
|
||||||
array(
|
|
||||||
/** @skipUpgrade */
|
|
||||||
'class' => 'MySQLDatabase',
|
|
||||||
'module' => 'framework',
|
|
||||||
'title' => 'MySQL 5.0+ (using MySQLi)',
|
|
||||||
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
|
|
||||||
'helperClass' => MySQLDatabaseConfigurationHelper::class,
|
|
||||||
'supported' => class_exists('MySQLi'),
|
|
||||||
'missingExtensionText' =>
|
|
||||||
'The <a href="http://www.php.net/manual/en/book.mysqli.php">MySQLi</a>
|
|
||||||
PHP extension is not available. Please install or enable it and refresh this page.'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Setup MySQL PDO as alternate option
|
// Register MySQL PDO as a database adapter (listed as first option in Dev/Install/config-form.html)
|
||||||
DatabaseAdapterRegistry::register(
|
DatabaseAdapterRegistry::register(
|
||||||
array(
|
array(
|
||||||
/** @skipUpgrade */
|
/** @skipUpgrade */
|
||||||
@ -36,3 +21,19 @@ DatabaseAdapterRegistry::register(
|
|||||||
are unavailable. Please install or enable these and refresh this page.'
|
are unavailable. Please install or enable these and refresh this page.'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Register MySQLi as a database adapter (listed as second option in Dev/Install/config-form.html)
|
||||||
|
DatabaseAdapterRegistry::register(
|
||||||
|
array(
|
||||||
|
/** @skipUpgrade */
|
||||||
|
'class' => 'MySQLDatabase',
|
||||||
|
'module' => 'framework',
|
||||||
|
'title' => 'MySQL 5.0+ (using MySQLi)',
|
||||||
|
'helperPath' => __DIR__ . '/src/Dev/Install/MySQLDatabaseConfigurationHelper.php',
|
||||||
|
'helperClass' => MySQLDatabaseConfigurationHelper::class,
|
||||||
|
'supported' => class_exists('MySQLi'),
|
||||||
|
'missingExtensionText' =>
|
||||||
|
'The <a href="http://www.php.net/manual/en/book.mysqli.php">MySQLi</a>
|
||||||
|
PHP extension is not available. Please install or enable it and refresh this page.'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
@ -183,14 +183,15 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="action">
|
|
||||||
<input type="submit" class="action" value="Re-check requirements">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clear"><!-- --></div>
|
<div class="clear"><!-- --></div>
|
||||||
|
|
||||||
|
<div class="action">
|
||||||
|
<input type="submit" class="action" value="Re-check requirements">
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3 class="sectionHeading">CMS Admin Account <small>Step 3 of 5</small></h3>
|
<h3 class="sectionHeading">CMS Admin Account <small>Step 3 of 5</small></h3>
|
||||||
|
|
||||||
<div id="AdminAccount" class="section">
|
<div id="AdminAccount" class="section">
|
||||||
@ -240,6 +241,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="action">
|
||||||
|
<input type="submit" class="action" value="Re-check requirements">
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3 class="sectionHeading">Theme selection <small>Step 4 of 5</small></h3>
|
<h3 class="sectionHeading">Theme selection <small>Step 4 of 5</small></h3>
|
||||||
<p class="helpText">You can change the theme or <a href="http://addons.silverstripe.org/add-ons?type=theme">download</a> another from the SilverStripe website after installation.</p>
|
<p class="helpText">You can change the theme or <a href="http://addons.silverstripe.org/add-ons?type=theme">download</a> another from the SilverStripe website after installation.</p>
|
||||||
<ul id="Themes">
|
<ul id="Themes">
|
||||||
|
@ -142,8 +142,16 @@ if(isset($_REQUEST['db'])) {
|
|||||||
if(isset($_REQUEST['db']['type'])) {
|
if(isset($_REQUEST['db']['type'])) {
|
||||||
$type = $_REQUEST['db']['type'];
|
$type = $_REQUEST['db']['type'];
|
||||||
} else {
|
} else {
|
||||||
$type = $_REQUEST['db']['type'] = defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : 'MySQLDatabase';
|
if( defined('SS_DATABASE_CLASS') ){
|
||||||
}
|
$type = $_REQUEST['db']['type'] = SS_DATABASE_CLASS;
|
||||||
|
} elseif( $databaseClasses['MySQLPDODatabase']['supported'] ) {
|
||||||
|
$type = $_REQUEST['db']['type'] = 'MySQLPDODatabase';
|
||||||
|
} elseif( $databaseClasses['MySQLDatabase']['supported'] ) {
|
||||||
|
$type = $_REQUEST['db']['type'] = 'MySQLDatabase';
|
||||||
|
} else {
|
||||||
|
// handle error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Disabled inputs don't submit anything - we need to use the environment (except the database name)
|
// Disabled inputs don't submit anything - we need to use the environment (except the database name)
|
||||||
if($usingEnv) {
|
if($usingEnv) {
|
||||||
@ -161,7 +169,15 @@ if(isset($_REQUEST['db'])) {
|
|||||||
$databaseConfig['type'] = $type;
|
$databaseConfig['type'] = $type;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$type = $_REQUEST['db']['type'] = defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : 'MySQLDatabase';
|
if( defined('SS_DATABASE_CLASS') ){
|
||||||
|
$type = $_REQUEST['db']['type'] = SS_DATABASE_CLASS;
|
||||||
|
} elseif( $databaseClasses['MySQLPDODatabase']['supported'] ) {
|
||||||
|
$type = $_REQUEST['db']['type'] = 'MySQLPDODatabase';
|
||||||
|
} elseif( $databaseClasses['MySQLDatabase']['supported'] ) {
|
||||||
|
$type = $_REQUEST['db']['type'] = 'MySQLDatabase';
|
||||||
|
} else {
|
||||||
|
// handle error
|
||||||
|
}
|
||||||
$_REQUEST['db'][$type] = $databaseConfig = array(
|
$_REQUEST['db'][$type] = $databaseConfig = array(
|
||||||
"type" => $type,
|
"type" => $type,
|
||||||
"server" => defined('SS_DATABASE_SERVER') ? SS_DATABASE_SERVER : "localhost",
|
"server" => defined('SS_DATABASE_SERVER') ? SS_DATABASE_SERVER : "localhost",
|
||||||
|
Loading…
Reference in New Issue
Block a user