\n"; if (file_exists('../cfg/cfg.system.php')) include('../cfg/cfg.system.php'); else die('missing syscfg'); echo " syscfg found and loaded
\n"; echo "
\n"; echo "checking database tables
\n"; try { $db = DB::newInstance($cfg['db']['dsn'],$cfg['db']['user'],$cfg['db']['passwd']); echo "- database connection successfull
"; echo "-- type: ".$db->getDialect().' '.$db->getServerVersion(); if (file_exists($systablefile)) { echo "- systables.xml found for version ".MCMS."

\n"; $tablesdef = simplexml_load_file($systablefile); foreach ($tablesdef as $tabledef) { $tableInfo = TableInfo::fromXML($tabledef); echo "-- table defined: ".$tableInfo->getName().' (columns: '.$tableInfo->getColumnCount()."), "; if ($db->tableExists($tableInfo->getName())) { $realTableInfo = $db->table($tableInfo->getName())->getInfo(); $diff = $tableInfo->compareTo($realTableInfo); if (isset($diff->missingColumns)) echo '
---- missing columns: '.implode(', ',$diff->missingColumns)." getName()."\"/>"; if (isset($diff->additionalColumns)) echo '
---- removeable columns: '.implode(', ',$diff->additionalColumns)." getName()."\"/>"; if (isset($diff->differentColumns)) { foreach ($diff->differentColumns as $name => $colDiffs) { foreach ($colDiffs as $type => $colDiff) { switch ($type) { case 'size': echo '
--- different sizes of '.$name.':'.$colDiff['this'].'!='.$colDiff['other']; break; case 'type': echo '
--- different types of '.$name.':'.$colDiff['this'].'!='.$colDiff['other']; break; case 'enum': echo '
--- different enum options of '.$name.':'.implode(',',$colDiff['this']).'!='.implode(',',$colDiff['other']); break; } } } } if (isset($diff->missingColumns) || isset($diff->additionalColumns) || isset($diff->differentColumns)) echo "
mismatch!

\n"; else echo "found and ok

\n"; } else echo "missing! check to create getName()."\"/>

\n"; } } else { echo "- systables.xml missing for version ".MCMS."

\n"; $valid = false; } } catch (DBException $e) { echo "- error: ".$e->getMessage(); $valid=false; } echo "
\n"; if ($valid) echo ''; } else { $valid = true; echo "checking system config:
\n"; if (file_exists('../cfg/cfg.system.php')) include('../cfg/cfg.system.php'); else die('missing syscfg'); echo "- syscfg found and loaded
\n"; echo "
\n"; echo "verifing database connection
\n"; try { $db = DB::newInstance($cfg['db']['dsn'],$cfg['db']['user'],$cfg['db']['passwd']); echo "- database connection successfull


\n"; if (!$valid) die('terminated'); switch ($_REQUEST['step']) { case 1: if (file_exists($systablefile)) { echo "using database:".$db->getDatabase()."
\n"; echo "- systables.xml found

\n"; $tablesdef = simplexml_load_file($systablefile); foreach ($tablesdef as $tabledef) { $tableInfo = TableInfo::fromXML($tabledef); echo "-- table defined: ".$tableInfo->getName().' (columns: '.$tableInfo->getColumnCount()."), "; if (isset($_REQUEST['createtable']) && in_array($tableInfo->getName(),$_REQUEST['createtable'])) { echo "-- creating table : ".$tableInfo->getName(); try { if ($db->tableExists($tableInfo->getName())) $db->dropTable($tableInfo->getName()); $db->createTable($tableInfo); echo "... OK

"; } catch (SQLException $e) { echo "...error!

".$e->getMessage()."
".$e->getQuery().'
'; } } if ($db->tableExists($tableInfo->getName())) { $realTableInfo = $db->table($tableInfo->getName())->getInfo(); $diff = $tableInfo->compareTo($realTableInfo); if (isset($diff->missingColumns)) { foreach ($diff->missingColumns as $missing) { $colNum = $tableInfo->getColumnNum($missing); $colInfo = $tableInfo->getColumn($colNum); $preCol = false; if ($colNum > 0) $preCol = $tableInfo->getColumn($colNum-1)->getName(); if ($preCol) $db->table($tableInfo->getName())->addColumn($colInfo,$preCol); else $db->table($tableInfo->getName())->addColumn($colInfo); } } if (isset($_REQUEST['removecolumns']) && in_array($tableInfo->getName(),$_REQUEST['removecolumns'])) { try { if (isset($diff->additionalColumns)) { foreach($diff->additionalColumns as $colToRemove) $db->table($tableInfo->getName())->removeColumn($colToRemove); } echo "... OK

"; } catch (SQLException $e) { echo "...error!

".$e->getMessage()."
".$e->getQuery().'
'; } } } } } else { echo "- systables.xml missing

\n"; $valid = false; } if ($valid) { echo 'Go to next step page'; } else echo 'go back'; break; case 3: echo '
All done, now remove the /install directory
'; echo 'Then you can go to the admin page or the main page'; break; } echo ''; } ?>