예제 #1
0
 public static function setup_by_config_file($configFile = '', $echo = false)
 {
     $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $successString = "[  OK  ]\n";
     $failureString = "[FAILED]\n";
     if (strlen($configFile) and file_exists($configFile)) {
         $configFileName = $configFile;
     } else {
         $configFileName = $container->getHome() . 'core/conf/kickstart.ini';
     }
     if (!file_exists($configFileName)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     $log = $container->getLogger();
     $cfg = @parse_ini_file($configFileName);
     if ($echo) {
         echo str_pad('System check: ', 60);
     }
     if (!InnomaticSetup::checksystem('', $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Edition setting: ', 60);
     }
     if (!InnomaticSetup::setEdition(array('edition' => $cfg['PlatformEdition']))) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Files installation: ', 60);
     }
     if (!InnomaticSetup::installfiles('', $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Database drivers creation: ', 60);
     }
     if (!InnomaticSetup::dataaccessdrivers('', $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Innomatic database creation: ', 60);
     }
     $dbArgs = array('dbtype' => $cfg['RootDatabaseType'], 'dbname' => $cfg['RootDatabaseName'], 'dbhost' => $cfg['RootDatabaseHost'], 'dbport' => $cfg['RootDatabasePort'], 'dbuser' => $cfg['RootDatabaseUser'], 'dbpass' => $cfg['RootDatabasePassword']);
     if (!InnomaticSetup::createdb($dbArgs, $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Components initialization (may take some time): ', 60);
     }
     $reg = \Innomatic\Util\Registry::instance();
     $dbArgs['dblog'] = $container->getHome() . 'core/log/innomatic_root_db.log';
     if (!InnomaticSetup::initializecomponents($dbArgs, $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Root password: '******'passworda'] = $cfg['RootPassword'];
     $pwdArgs['passwordb'] = $cfg['RootPassword'];
     if (!InnomaticSetup::setpassword($pwdArgs, $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Network settings: ', 60);
     }
     $hostArgs['innomatichost'] = $cfg['PlatformName'];
     $hostArgs['innomaticgroup'] = $cfg['PlatformGroup'];
     if (!InnomaticSetup::setinnomatichost($hostArgs, $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Country setting: ', 60);
     }
     $country_args['country'] = $cfg['RootCountry'];
     if (!InnomaticSetup::setcountry($country_args, $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Language setting: ', 60);
     }
     $lang_args['language'] = $cfg['RootLanguage'];
     if (!InnomaticSetup::setlanguage($lang_args, $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Base URL setting: ', 60);
     }
     if (!InnomaticSetup::setBaseUrl($cfg['InnomaticBaseUrl'])) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Clean up: ', 60);
     }
     if (!InnomaticSetup::cleanup('', $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Setup finish: ', 60);
     }
     if (!InnomaticSetup::finish('', $log)) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Remotion of setup phases locks: ', 60);
     }
     if (!InnomaticSetup::check_lock_files()) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     if ($echo) {
         echo $successString . str_pad('Remotion of setup lock: ', 60);
     }
     InnomaticSetup::remove_lock_files();
     if (!InnomaticSetup::remove_setup_lock_file()) {
         if ($echo) {
             echo $failureString;
         }
         return false;
     }
     echo $successString;
     return true;
 }
예제 #2
0
    \Innomatic\Setup\InnomaticSetup::cleanup($eventData, $log);
}
$actionDispatcher->addEvent('finish', 'pass_finish');
function pass_finish($eventData)
{
    global $innomaticLocale;
    $log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger();
    \Innomatic\Setup\InnomaticSetup::finish($eventData, $log);
}
$actionDispatcher->Dispatch();
// Checks if all setup phases are completed
//
if (\Innomatic\Setup\InnomaticSetup::check_lock_files()) {
    // Removes setup lock files
    //
    \Innomatic\Setup\InnomaticSetup::remove_lock_files();
    if (!\Innomatic\Setup\InnomaticSetup::remove_setup_lock_file()) {
        $log->logEvent('innomatic.root.main_php', 'Unable to remove lock file during initialization', \Innomatic\Logging\Logger::ERROR);
    }
}
clearstatcache();
// Progressbar
$progress_vert_group = new WuiVertgroup('mainvertgroup', array('width' => '0%'));
$progress_headers[1]['label'] = $innomaticLocale->getStr('setupphase_header');
$progress_table = new WuiTable('sumtable', array('headers' => $progress_headers));
$phase = 0;
$phases = 13;
$progress = 0;
setup_entry($progress, $phases, 'setup_checkingsystem', 'setup_systemchecked', $innomaticLocale->getStr('systemcheckphase_label'), $progress_table, $phase++);
setup_entry($progress, $phases, 'setup_installingfiles', 'setup_filesinstalled', $innomaticLocale->getStr('filesinstallphase_label'), $progress_table, $phase++);
setup_entry($progress, $phases, 'setup_settingedition', 'setup_editionset', $innomaticLocale->getStr('editionchoicephase_label'), $progress_table, $phase++);