/* ===================================================[ INSTALL DATABASE TABLES ]=================================================== */ if ($steps[STEP_RUNSQL]['enabled']) { if (!$dbase->IsConnected()) { $page->MainTitle($steps[STEP_RUNSQL]['title'], 'sql'); $page->WarningBox('Connection has not been made to a database server. The step <a href="?step=' . STEP_DBCONNECT . '">' . '<b>' . $steps[STEP_DBCONNECT]['title'] . '</b></a> must be processed first!'); $page->ShowPage(STEP_RUNSQL); } if (!$dbase->IsDatabaseSelected()) { $page->MainTitle($steps[STEP_RUNSQL]['title'], 'sql'); $page->WarningBox('Database has not been selected. The step <a href="?step=' . STEP_DBSELECT . '">' . '<b>' . $steps[STEP_DBSELECT]['title'] . '</b></a> must be processed first!'); $page->ShowPage(STEP_RUNSQL); } // If a request has been made to run SQL installation script on the selected database, // run the script and set installation status to sessions $databaseErrorMessage = ''; if (isset($_REQUEST['runsql']) && $dbase->GetDatabaseName() == $_REQUEST['runsql']) { // Get the installation queries and split them by the "next query" separator, // and then run each query and get an array of results. If there is no split // then the query will be an array with only one cell - still an array :) $results = $dbase->RunQuery($mask->GetSqlInstallQueries(TRUE)); // Go through all the results, and every one of them must be 'true' // othervice some query failed and installation is incomplete! $databaseSuccessCount = 0; $databaseFailedCount = 0; foreach ($results as $result) { if ($result['success']) { $databaseSuccessCount++; } else { $databaseFailedCount++; $databaseErrorMessage .= $result['error'] . "<br />\n"; }
$page->FormButton('Back', array('step'=>GetPrevStep(STEP_ROOTUSER))); $page->FormSubmit('Next'); $page->FormClose(); } $page->ShowPage(STEP_ROOTUSER); } /* ===================================================[ INSTALL DATABASE TABLES ]=================================================== */ // If a request has been made to run SQL installation script on the selected database, // run the script and set installation status to sessions $databaseErrorMessage = ''; if($steps[STEP_RUNSQL]['enabled'] && isset($_REQUEST['runsql']) && $dbase->GetDatabaseName() == $_REQUEST['runsql']) { // Get the installation queries and split them by the "next query" separator, // and then run each query and get an array of results. If there is no split // then the query will be an array with only one cell - still an array :) $results = $dbase->RunQuery( $mask->GetSqlInstallQueries(true), false ); // Go through all the results, and every one of them must be 'true' // otherwise some query failed and installation is incomplete! $databaseSuccessCount = 0; $databaseFailedCount = 0; foreach($results as $result) { if($result['success']) $databaseSuccessCount++; else