/** * Installation de la base de données depuis un fichier * * @param string $db_file */ protected function loadDbFile($db_file, $process = null) { static $count; if (empty($count)) { $count = 1; } if (file_exists($db_file)) { $xsql = new xmlsql($this->db, file_get_contents($db_file), $this->checklist, $process); $xsql->replace('{{PREFIX}}', $this->okt->db->prefix); $xsql->execute(); } else { $this->checklist->addItem('db_file_' . $count, null, 'DB file ' . $db_file . ' doesn\'t exists', 'DB file ' . $db_file . ' doesn\'t exists'); } $count++; }
public static function dbUpdate($oChecklist = null) { global $okt; if (empty($okt) || !$okt instanceof oktCore) { return false; } if (is_null($oChecklist) || !$oChecklist instanceof checkList) { $oChecklist = new checkList(); } foreach (new DirectoryIterator(OKT_INC_PATH . '/sql_schema/') as $oFileInfo) { if ($oFileInfo->isDot() || !$oFileInfo->isFile() || $oFileInfo->getExtension() !== 'xml') { continue; } $xsql = new xmlsql($okt->db, file_get_contents($oFileInfo->getPathname()), $oChecklist, 'update'); $xsql->replace('{{PREFIX}}', OKT_DB_PREFIX); $xsql->execute(); } }
if (!defined('OKT_INSTAL_PROCESS')) { die; } /* Initialisations ------------------------------------------------------------*/ require_once OKT_CONFIG_PATH . '/connexion.php'; $db = oktDb::getInstance(); $oChecklist = new checkList(); /* Traitements ------------------------------------------------------------*/ foreach (new DirectoryIterator(OKT_INC_PATH . '/sql_schema/') as $oFileInfo) { if ($oFileInfo->isDot() || !$oFileInfo->isFile() || $oFileInfo->getExtension() !== 'xml') { continue; } $xsql = new xmlsql($db, file_get_contents($oFileInfo->getPathname()), $oChecklist, $_SESSION['okt_install_process_type']); $xsql->replace('{{PREFIX}}', OKT_DB_PREFIX); $xsql->execute(); } /* Affichage ------------------------------------------------------------*/ # En-tête $title = __('Creating tables'); require OKT_INSTAL_DIR . '/header.php'; ?> <?php echo $oChecklist->getHTML(); ?> <?php if ($oChecklist->checkAll()) {