load($configDir."/settings.xml"); /** * Check if ENABLE_INSTALL_TOOL exists in config dir */ if (!file_exists($configDir."/ENABLE_INSTALL_TOOL")) { echo "For installation of SeedDMS, you must create the file conf/ENABLE_INSTALL_TOOL"; exit; } $theme = "blue"; require_once("../inc/inc.Language.php"); require_once("../inc/inc.ClassUI.php"); UI::htmlStartPage('Database update'); UI::contentHeading("SeedDMS Installation for version ".$_GET['version']); UI::contentContainerStart(); $sqlfile = "update.sql"; switch($settings->_dbDriver) { case 'mysql': case 'mysqli': case 'mysqlnd': $dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$settings->_dbHostname; break; case 'sqlite': $dsn = $settings->_dbDriver.":".$settings->_dbDatabase; if(file_exists('update-'.$_GET['version'].'/update-sqlite3.sql')) $sqlfile = "update-sqlite3.sql"; break; } $db = new PDO($dsn, $settings->_dbUser, $settings->_dbPass); if (!$db) { die; } $errorMsg = ''; $res = $db->query('select * from tblVersion'); if($rec = $res->fetch(PDO::FETCH_ASSOC)) { if($_GET['version'] > $rec['major'].'.'.$rec['minor'].'.'.$rec['subminor']) { if(file_exists('update-'.$_GET['version'].'/'.$sqlfile)) { $queries = file_get_contents('update-'.$_GET['version'].'/'.$sqlfile); $queries = explode(";", $queries); // execute queries if($queries) { echo "
SQL file for update missing!
"; } } else { echo "Database schema already up to date.
"; } if(!$errorMsg) { if(file_exists('update-'.$_GET['version'].'/update.php')) { echo "Go back to installation and recheck.
"; } else { echo "Could not determine database schema version.
"; } $db = null; UI::contentContainerEnd(); UI::htmlEndPage(); ?>