Example #1
0
<html>
<head><title>migrate!</title></head>
<body>
<style type="text/css">.error{font-weight: bold; color:#900;}</style>
<?php 
require_once 'config.php';
require_once 'tables.php';
$t_start = time();
$db_src = new Database($config['database']['source']);
$db_dst = new Database($config['database']['destination']);
foreach ($tables as $table) {
    $src_fields = $db_src->get_table_fields($table['source']);
    $excluded = isset($table['exclude']) ? explode(",", $table['exclude']) : array();
    $included = isset($table['include']) ? explode(",", $table['include']) : array();
    if (count($excluded) > 0 && count($included) > 0) {
        ER("Error in {$table}: both included and excluded fields at the same time. Skipping.");
        continue;
    } else {
        if (count($excluded) > 0) {
            $mode = "excluding";
        } else {
            if (count($included) > 0) {
                $mode = "including";
            }
        }
    }
    $dst_fields = array();
    foreach ($src_fields as $name => $field) {
        if ($mode == "excluding" && in_array($name, $excluded)) {
            continue;
        } else {