$list = mysql__getdatabases(); $dbname = $_POST['uname']."_".$_POST['dbname']; if(array_key_exists($dbname, $list)){ echo "<h3>Database '".$dbname."' already exists. Choose different name</h3>"; }else{*/ ?> <div id="loading"> <img src="../../common/images/mini-loading.gif" width="16" height="16" /> <strong><span id="divProgress"> Creating database, please wait</span></strong> </div> <script type="text/javascript">showProgress();</script> <?php ob_flush();flush(); //sleep(5); makeDatabase(); // this does all the work } if($isCreateNew){ ?> <div id="challengeForDB" style="<?='display:'.(($passwordForDatabaseCreation=='')?'none':'block')?>;"> <h3>Enter the password set by your system adminstrator for new database creation:</h3> <input type="password" maxlength="64" size="25" id="pwd"> <input type="button" onclick="challengeForDB()" value="OK" style="font-weight: bold;" > </div> <div id="createDBForm" style="<?='display:'.($passwordForDatabaseCreation==''?'block':'none')?>;padding-top:20px;"> <form action="createNewDB.php?db=<?= HEURIST_DBNAME ?>" method="POST" name="NewDBName" onsubmit="return onBeforeSubmit()"> <?php if(!is_logged_in()) { ?> <div id="detailTypeValues" style="border-bottom: 1px solid #7f9db9;padding-bottom:10px;">
} if (!$file) { $file = $mysql[0]; } } if ($file) { break; } } if (!file_exists($file)) { die('Not found sql'); } $sql = $_SERVER['DOCUMENT_ROOT'] . '/' . $file; $command = 'cd ../mysql/bin<br>'; $command .= "mysql -u root -p {$database} < {$sql}<br>"; makeDatabase($database, $command); // Change Node XML $pathXml = $_SERVER['DOCUMENT_ROOT'] . '/' . $folder . '/app/etc/local.xml'; if (!file_exists($pathXml)) { die('Not found XML'); } $testimonials = simplexml_load_file($pathXml); // there can be only one item with a specific id, but foreach doesn't hurt here $xpath = 'global/resources/default_setup/connection'; foreach ($testimonials->xpath($xpath) as $t) { $t->dbname = $database; } $testimonials->asXML($pathXml); // End change Node XML $setup = true; //$setup = false;
// or by querying an existing Heurist database using getDBStructureAsSQL (for crosswalk or use of database as template) $isNewDB = false; global $errorCreatingTables; // Set to true by buildCrosswalks if error occurred global $done; // Prevents the makeDatabase() script from running twice $done = false; // redundant $isDefineNewDatabase = true; if (isset($_REQUEST['dbname'])) { //name of new database $isDefineNewDatabase = false; $dbTemplateName = @$_REQUEST['dbtype']; echo_flush('<script type="text/javascript">showProgress(true);</script>'); // ***************************************** makeDatabase(); // this does all the work // ***************************************** //echo_flush( '<script type="text/javascript">hideProgress();</script>' ); } print '<script type="text/javascript">hideProgress();</script>'; $dataInsertionSQLFile = ""; // normal case is not to insert any data if ($isDefineNewDatabase) { ?> <h3 style="padding:0 0 0 10px;">Creating new database on server</h3> <div id="challengeForDB" style="<?php echo 'display:' . ($passwordForDatabaseCreation == '' ? 'none' : 'block'); ?>