public function doUninstallAction($params)
 {
     $result = false;
     if (strlen($params['file'])) {
         $xmldb = new \Innomatic\Dataaccess\DataAccessXmlTable($this->rootda, \Innomatic\Dataaccess\DataAccessXmlTable::SQL_DROP);
         $xmldb->load_deffile($this->container->getHome() . 'core/db/' . basename($params['file']));
         if ($this->rootda->execute($xmldb->getSQL())) {
             if (@unlink($this->container->getHome() . 'core/db/' . basename($params['file']))) {
                 $result = true;
             } else {
                 $this->mLog->logEvent('innomatic.roottablecomponent.roottablecomponent.douninstallaction', 'In application ' . $this->appname . ', component ' . $params['name'] . ': Unable to remove root table file ' . $this->container->getHome() . 'core/db/' . basename($params['file']), \Innomatic\Logging\Logger::ERROR);
             }
         } else {
             $this->mLog->logEvent('innomatic.roottablecomponent.roottablecomponent.douninstallaction', 'In application ' . $this->appname . ', component ' . $params['name'] . ': Unable to drop root table from ' . basename($params['file']) . ' table file', \Innomatic\Logging\Logger::ERROR);
         }
         $xmldb->free();
     } else {
         $this->mLog->logEvent('innomatic.roottablecomponent.roottablecomponent.douninstallaction', 'In application ' . $this->appname . ', component ' . $params['name'] . ': Empty table file name', \Innomatic\Logging\Logger::ERROR);
     }
     return $result;
 }
 public static function createDb($eventData = '', $log = '')
 {
     $result = false;
     $reg = \Innomatic\Util\Registry::instance();
     $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $dasn_string = $eventData['dbtype'] . '://' . $eventData['dbuser'] . ':' . $eventData['dbpass'] . '@' . $eventData['dbhost'] . ':' . $eventData['dbport'] . '/' . $eventData['dbname'] . '?' . 'logfile=' . $innomatic->getHome() . 'core/log/innomatic_root_db.log';
     $tmpdb = \Innomatic\Dataaccess\DataAccessFactory::getDataAccess(new \Innomatic\Dataaccess\DataAccessSourceName($dasn_string));
     if ($tmpdb->Connect()) {
         $tmpdb->DropDB($eventData);
         $tmpdb->Close();
     }
     if ($tmpdb->CreateDB($eventData)) {
         if ($tmpdb->Connect()) {
             // Tables creation
             //
             $xmldb = new \Innomatic\Dataaccess\DataAccessXmlTable($tmpdb, \Innomatic\Dataaccess\DataAccessXmlTable::SQL_CREATE);
             if ($xmldb->load_DefFile($innomatic->getHome() . 'core/db/innomatic_root.xml')) {
                 if ($tmpdb->execute($xmldb->getSQL())) {
                     // Database configuration file creation
                     //
                     $fh = @fopen($innomatic->getHome() . 'core/conf/innomatic.ini', 'a');
                     if ($fh) {
                         fputs($fh, 'RootDatabaseType = ' . $eventData['dbtype'] . "\n");
                         fputs($fh, 'RootDatabaseName = ' . $eventData['dbname'] . "\n");
                         fputs($fh, 'RootDatabaseHost = ' . $eventData['dbhost'] . "\n");
                         fputs($fh, 'RootDatabasePort = ' . $eventData['dbport'] . "\n");
                         fputs($fh, 'RootDatabaseUser = '******'dbuser'] . "\n");
                         fputs($fh, 'RootDatabasePassword = '******'dbpass'] . "\n");
                         fputs($fh, 'RootDatabaseDebug = 0' . "\n");
                         fclose($fh);
                         $result = true;
                         @touch($innomatic->getHome() . 'core/temp/setup_dbcreated', time());
                         if (file_exists($innomatic->getHome() . 'core/temp/setup_creatingdb')) {
                             @unlink($innomatic->getHome() . 'core/temp/setup_creatingdb');
                         }
                     } else {
                         $log->logevent('innomatic.root.main_php', 'Unable to create root database configuration file during initialization', \Innomatic\Logging\Logger::ERROR);
                     }
                 } else {
                     $log->logevent('innomatic.root.main_php', 'Unable to create root database tables during initialization', \Innomatic\Logging\Logger::ERROR);
                 }
             } else {
                 $log->logevent('innomatic.root.main_php', 'Unable to open Innomatic structure file during initialization', \Innomatic\Logging\Logger::ERROR);
             }
         } else {
             $log->logevent('innomatic.root.main_php', 'Unable to connect to root database during initialization', \Innomatic\Logging\Logger::ERROR);
         }
     } else {
         $log->logevent('innomatic.root.main_php', 'Unable to create root database during initialization: ' . $tmpdb->getLastError(), \Innomatic\Logging\Logger::ERROR);
     }
     return $result;
 }
 public function doDisableDomainAction($domainid, $params)
 {
     $result = false;
     if (strlen($params['file'])) {
         $xmldb = new \Innomatic\Dataaccess\DataAccessXmlTable($this->domainda, \Innomatic\Dataaccess\DataAccessXmlTable::SQL_DROP);
         $xmldb->load_deffile($this->container->getHome() . 'core/db/' . $params['file']);
         if ($this->domainda->execute($xmldb->getSQL())) {
             $result = true;
         } else {
             $this->mLog->logEvent('innomatic.domaintablecomponent.domaintablecomponent.dodisabledomainaction', 'In application ' . $this->appname . ', component ' . $params['name'] . ': Unable to remove table from ' . $params['file'] . ' table file', \Innomatic\Logging\Logger::ERROR);
         }
     } else {
         $this->mLog->logEvent('innomatic.domaintablecomponent.domaintablecomponent.dodisabledomainaction', 'In application ' . $this->appname . ', component ' . $params['name'] . ': Empty table file name', \Innomatic\Logging\Logger::ERROR);
     }
     return $result;
 }