Exemple #1
0
$sql = $schema->ParseSchema('upgrade.xml');
$result = $schema->ExecuteSchema($sql);
$error = $db->ErrorMsg();
if ($result != true) {
    die('The following error was encountered while creating the database tables:<br/> ' . $error);
} else {
    echo 'No error were encountered.';
}
?>
 
    
    <h2>Step 5 - Updating Records</h2>

    <?php 
$upgrader = new Upgrader();
$upgrader->upgrade_languages();
$upgrader->upgrade_options();
?>
    
    <h2>Step 6 - Verifying Data</h2>

    <?php 
# Verifying tables
$tables_in_db = $db->MetaTables('TABLES');
$tables = array('language' => 10, 'options' => 14);
foreach ($tables as $table => $records) {
    $sql = 'SELECT COUNT(*) FROM ' . $g_db_prefix . $table;
    $count = $db->GetOne($sql);
    if ($count != $records) {
        die('The ' . $g_db_prefix . $table . ' table does not contain the correct number of records. Found ' . $count . ', but there should be ' . $records . '.');
    }