mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix db/build problems when creating a new database
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40473 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
44b68061d4
commit
e4e971a18f
@ -119,17 +119,14 @@ class ManifestBuilder {
|
|||||||
$manifest .= "\$_CSS_MANIFEST = " . var_export($cssManifest, true) . ";\n";
|
$manifest .= "\$_CSS_MANIFEST = " . var_export($cssManifest, true) . ";\n";
|
||||||
DB::connect($databaseConfig);
|
DB::connect($databaseConfig);
|
||||||
|
|
||||||
if(DB::isActive()) {
|
// Database manifest
|
||||||
// Database manifest
|
$allClasses = ManifestBuilder::allClasses($classManifest);
|
||||||
$allClasses = ManifestBuilder::allClasses($classManifest);
|
|
||||||
|
|
||||||
$manifest .= "\$_ALL_CLASSES = " . var_export($allClasses, true) . ";\n";
|
$manifest .= "\$_ALL_CLASSES = " . var_export($allClasses, true) . ";\n";
|
||||||
|
|
||||||
|
global $_ALL_CLASSES;
|
||||||
|
$_ALL_CLASSES = $allClasses;
|
||||||
|
|
||||||
global $_ALL_CLASSES;
|
|
||||||
$_ALL_CLASSES = $allClasses;
|
|
||||||
} else {
|
|
||||||
if(!isset($_REQUEST['from_installer'])) echo '<li>Waiting until the database is created before compiling the manifest</li>';
|
|
||||||
}
|
|
||||||
// Write manifest to disk
|
// Write manifest to disk
|
||||||
$manifest = "<?php\n$manifest\n?>";
|
$manifest = "<?php\n$manifest\n?>";
|
||||||
|
|
||||||
@ -201,7 +198,14 @@ class ManifestBuilder {
|
|||||||
$b = basename($file);
|
$b = basename($file);
|
||||||
if($b != 'cli-script.php' && $b != 'main.php') include_once($file);
|
if($b != 'cli-script.php' && $b != 'main.php') include_once($file);
|
||||||
}
|
}
|
||||||
$tables = DB::getConn()->tableList();
|
|
||||||
|
if(DB::isActive()) {
|
||||||
|
$tables = DB::getConn()->tableList();
|
||||||
|
} else {
|
||||||
|
$tables = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$allClasses['hastable'] = array();
|
||||||
|
|
||||||
// Build a map of classes and their subclasses
|
// Build a map of classes and their subclasses
|
||||||
$_classes = get_declared_classes();
|
$_classes = get_declared_classes();
|
||||||
|
@ -136,6 +136,7 @@ class DatabaseAdmin extends Controller {
|
|||||||
echo '<p><b>Creating database</b></p>';
|
echo '<p><b>Creating database</b></p>';
|
||||||
}
|
}
|
||||||
DB::createDatabase();
|
DB::createDatabase();
|
||||||
|
// ManifestBuilder::compileManifest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all our classes
|
// Get all our classes
|
||||||
@ -149,7 +150,7 @@ class DatabaseAdmin extends Controller {
|
|||||||
if(!$quiet) {
|
if(!$quiet) {
|
||||||
echo '<p><b>Creating database tables</b></p>';
|
echo '<p><b>Creating database tables</b></p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$conn->beginSchemaUpdate();
|
$conn->beginSchemaUpdate();
|
||||||
foreach($dataClasses as $dataClass) {
|
foreach($dataClasses as $dataClass) {
|
||||||
// Test_ indicates that it's the data class is part of testing system
|
// Test_ indicates that it's the data class is part of testing system
|
||||||
|
Loading…
Reference in New Issue
Block a user