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;
 }
Exemple #2
0
function pass_installfiles($eventData)
{
    global $innomaticLocale, $log;
    $log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger();
    \Innomatic\Setup\InnomaticSetup::installfiles($eventData, $log);
}