diff --git a/composer.json b/composer.json index 794a9c9e4..52309b90a 100644 --- a/composer.json +++ b/composer.json @@ -52,9 +52,9 @@ }, "require-dev": { "phpunit/phpunit": "^5.7", - "silverstripe/versioned": "^1.0@dev", + "silverstripe/versioned": "^1.0", "silverstripe/behat-extension": "^3", - "silverstripe/serve": "dev-master", + "silverstripe/serve": "^2", "se/selenium-server-standalone": "2.41.0" }, "provide": { diff --git a/src/Core/CoreKernel.php b/src/Core/CoreKernel.php index 951f78ef6..3f5e4cee1 100644 --- a/src/Core/CoreKernel.php +++ b/src/Core/CoreKernel.php @@ -359,7 +359,7 @@ class CoreKernel implements Kernel } // Allow database adapters to handle their own configuration - DatabaseAdapterRegistry::autoconfigure(); + DatabaseAdapterRegistry::autoconfigure($databaseConfig); return $databaseConfig; } diff --git a/src/Dev/Install/DatabaseAdapterRegistry.php b/src/Dev/Install/DatabaseAdapterRegistry.php index 4af6c7505..01554c014 100644 --- a/src/Dev/Install/DatabaseAdapterRegistry.php +++ b/src/Dev/Install/DatabaseAdapterRegistry.php @@ -3,6 +3,7 @@ namespace SilverStripe\Dev\Install; use InvalidArgumentException; +use SilverStripe\Dev\Deprecation; /** * This class keeps track of the available database adapters @@ -131,10 +132,19 @@ class DatabaseAdapterRegistry * Called by ConfigureFromEnv.php. * Searches through vendor/ folder only, * 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($vendor . '/*', GLOB_ONLYDIR) as $directory) { if (file_exists($directory . '/_configure_database.php')) { @@ -142,6 +152,8 @@ class DatabaseAdapterRegistry } } } + // Update modified variable + $config = $databaseConfig; } /** diff --git a/src/ORM/Connect/DBSchemaManager.php b/src/ORM/Connect/DBSchemaManager.php index d8f4a2789..2eccafaa7 100644 --- a/src/ORM/Connect/DBSchemaManager.php +++ b/src/ORM/Connect/DBSchemaManager.php @@ -899,8 +899,7 @@ abstract class DBSchemaManager * * @param string $tableName The name of the table. * @param string $indexName The name of the index. - * @param string $indexSpec The specification of the index, see {@link SS_Database::requireIndex()} - * for more details. + * @param array $indexSpec The specification of the index, see Database::requireIndex() for more details. * @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);