mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #7622 from open-sausages/pulls/4.0/fix-database-config
BUG Fix _configure_database.php being ignored
This commit is contained in:
commit
1b145541c4
@ -52,9 +52,9 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^5.7",
|
"phpunit/phpunit": "^5.7",
|
||||||
"silverstripe/versioned": "^1.0@dev",
|
"silverstripe/versioned": "^1.0",
|
||||||
"silverstripe/behat-extension": "^3",
|
"silverstripe/behat-extension": "^3",
|
||||||
"silverstripe/serve": "dev-master",
|
"silverstripe/serve": "^2",
|
||||||
"se/selenium-server-standalone": "2.41.0"
|
"se/selenium-server-standalone": "2.41.0"
|
||||||
},
|
},
|
||||||
"provide": {
|
"provide": {
|
||||||
|
@ -359,7 +359,7 @@ class CoreKernel implements Kernel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow database adapters to handle their own configuration
|
// Allow database adapters to handle their own configuration
|
||||||
DatabaseAdapterRegistry::autoconfigure();
|
DatabaseAdapterRegistry::autoconfigure($databaseConfig);
|
||||||
return $databaseConfig;
|
return $databaseConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\Dev\Install;
|
namespace SilverStripe\Dev\Install;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class keeps track of the available database adapters
|
* This class keeps track of the available database adapters
|
||||||
@ -131,10 +132,19 @@ class DatabaseAdapterRegistry
|
|||||||
* Called by ConfigureFromEnv.php.
|
* Called by ConfigureFromEnv.php.
|
||||||
* Searches through vendor/ folder only,
|
* Searches through vendor/ folder only,
|
||||||
* does not support "legacy" folder location in webroot
|
* does not support "legacy" folder location in webroot
|
||||||
|
*
|
||||||
|
* @param array $config Config to update. If not provided fall back to global $databaseConfig.
|
||||||
|
* In 5.0.0 this will be mandatory and the global will be removed.
|
||||||
*/
|
*/
|
||||||
public static function autoconfigure()
|
public static function autoconfigure(&$config = null)
|
||||||
{
|
{
|
||||||
// Search through all composer packages in vendor
|
if (!isset($config)) {
|
||||||
|
Deprecation::notice('5.0', 'Configuration via global is deprecated');
|
||||||
|
global $databaseConfig;
|
||||||
|
} else {
|
||||||
|
$databaseConfig = $config;
|
||||||
|
}
|
||||||
|
// Search through all composer packages in vendor, updating $databaseConfig
|
||||||
foreach (glob(BASE_PATH . '/vendor/*', GLOB_ONLYDIR) as $vendor) {
|
foreach (glob(BASE_PATH . '/vendor/*', GLOB_ONLYDIR) as $vendor) {
|
||||||
foreach (glob($vendor . '/*', GLOB_ONLYDIR) as $directory) {
|
foreach (glob($vendor . '/*', GLOB_ONLYDIR) as $directory) {
|
||||||
if (file_exists($directory . '/_configure_database.php')) {
|
if (file_exists($directory . '/_configure_database.php')) {
|
||||||
@ -142,6 +152,8 @@ class DatabaseAdapterRegistry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Update modified variable
|
||||||
|
$config = $databaseConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -899,8 +899,7 @@ abstract class DBSchemaManager
|
|||||||
*
|
*
|
||||||
* @param string $tableName The name of the table.
|
* @param string $tableName The name of the table.
|
||||||
* @param string $indexName The name of the index.
|
* @param string $indexName The name of the index.
|
||||||
* @param string $indexSpec The specification of the index, see {@link SS_Database::requireIndex()}
|
* @param array $indexSpec The specification of the index, see Database::requireIndex() for more details.
|
||||||
* for more details.
|
|
||||||
* @todo Find out where this is called from - Is it even used? Aren't indexes always dropped and re-added?
|
* @todo Find out where this is called from - Is it even used? Aren't indexes always dropped and re-added?
|
||||||
*/
|
*/
|
||||||
abstract public function alterIndex($tableName, $indexName, $indexSpec);
|
abstract public function alterIndex($tableName, $indexName, $indexSpec);
|
||||||
|
Loading…
Reference in New Issue
Block a user