mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Database will fix itself if you view the site and the database doesn't exist
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@72497 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d904c0b8d0
commit
a1e48eff8e
@ -13,6 +13,14 @@ class ModelAsController extends Controller implements NestedController {
|
||||
$this->urlParams = $request->allParams();
|
||||
|
||||
$this->init();
|
||||
|
||||
// If the basic database hasn't been created, then build it.
|
||||
if(!DB::isActive() || !ClassInfo::hasTable('SiteTree')) {
|
||||
$this->response = new HTTPResponse();
|
||||
$this->redirect("dev/build?returnURL=" . urlencode($_GET['url']));
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
$result = $this->getNestedController();
|
||||
|
||||
if(is_object($result) && $result instanceOf RequestHandler) {
|
||||
|
@ -19,6 +19,13 @@ class RootURLController extends Controller {
|
||||
|
||||
$this->init();
|
||||
|
||||
// If the basic database hasn't been created, then build it.
|
||||
if(!DB::isActive() || !ClassInfo::hasTable('SiteTree')) {
|
||||
$this->response = new HTTPResponse();
|
||||
$this->redirect("dev/build?returnURL=");
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
$controller = new ModelAsController();
|
||||
|
||||
$request = new HTTPRequest("GET", self::get_homepage_urlsegment().'/', $request->getVars(), $request->postVars());
|
||||
|
@ -78,7 +78,14 @@ class DatabaseAdmin extends Controller {
|
||||
ManifestBuilder::create_manifest_file();
|
||||
require(MANIFEST_FILE);
|
||||
|
||||
$this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer']), !isset($_REQUEST['dont_populate']));
|
||||
if(isset($_GET['returnURL'])) {
|
||||
echo "<p>Setting up the database; you will be returned to your site shortly....</p>";
|
||||
$this->doBuild(true);
|
||||
echo "<p>Done!</p>";
|
||||
Director::redirect($_GET['returnURL']);
|
||||
} else {
|
||||
$this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer']), !isset($_REQUEST['dont_populate']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user