mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG fix db bootstrapping issues
This commit is contained in:
parent
7ed4660e7a
commit
188ce35d82
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ORM;
|
namespace SilverStripe\ORM;
|
||||||
|
|
||||||
|
use BadMethodCallException;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
@ -221,17 +222,16 @@ class DatabaseAdmin extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load parameters from existing configuration
|
// Load parameters from existing configuration
|
||||||
global $databaseConfig;
|
$databaseConfig = DB::getConfig();
|
||||||
if (empty($databaseConfig) && empty($_REQUEST['db'])) {
|
if (empty($databaseConfig) && empty($_REQUEST['db'])) {
|
||||||
user_error("No database configuration available", E_USER_ERROR);
|
throw new BadMethodCallException("No database configuration available");
|
||||||
}
|
}
|
||||||
$parameters = (!empty($databaseConfig)) ? $databaseConfig : $_REQUEST['db'];
|
$parameters = (!empty($databaseConfig)) ? $databaseConfig : $_REQUEST['db'];
|
||||||
|
|
||||||
// Check database name is given
|
// Check database name is given
|
||||||
if (empty($parameters['database'])) {
|
if (empty($parameters['database'])) {
|
||||||
user_error(
|
throw new BadMethodCallException(
|
||||||
"No database name given; please give a value for \$databaseConfig['database']",
|
"No database name given; please give a value for SS_DATABASE_NAME or set SS_DATABASE_CHOOSE_NAME"
|
||||||
E_USER_ERROR
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$database = $parameters['database'];
|
$database = $parameters['database'];
|
||||||
|
@ -45,6 +45,10 @@ class AuthenticationRequestFilter implements RequestFilter
|
|||||||
*/
|
*/
|
||||||
public function preRequest(HTTPRequest $request)
|
public function preRequest(HTTPRequest $request)
|
||||||
{
|
{
|
||||||
|
if (!Security::database_is_ready()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this
|
$this
|
||||||
->getAuthenticationHandler()
|
->getAuthenticationHandler()
|
||||||
|
Loading…
Reference in New Issue
Block a user