Пример #1
0
function upgrade_domain_databases($continue_r)
{
    $continue = $continue_r;
    $con = null;
    $con = connect_database($continue, "ring");
    $continue = $con != null;
    global $db_ring_domain;
    for ($i = 1; $i <= $db_ring_domain; $i++) {
        if ($continue && get_db_version("ring") < $i) {
            $continue = update_database_structure($continue, $con, "ring_domain_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql");
            $continue = set_db_version($continue, "ring", $i);
        }
    }
    disconnect_database($con, "ring");
    return $continue;
}
Пример #2
0
                 echo " Done ({$update_time})." . PHP_EOL;
             } else {
                 if ($err) {
                     echo " Done ({$update_time}, {$err} errors)." . PHP_EOL;
                     logfile('update-errors.log', "====== Schema update " . sprintf("%03d", $db_rev) . " -> " . sprintf("%03d", $filename) . " ==============");
                     foreach ($errors as $error) {
                         logfile('update-errors.log', "Query: " . $error['query']);
                         logfile('update-errors.log', "Error: " . $error['error']);
                     }
                     unset($errors);
                 } else {
                     echo " Done ({$update_time})." . PHP_EOL;
                 }
             }
             // SQL update done, update dbSchema
             $schema_status = set_db_version($filename, $schema_insert);
             if ($schema_insert && $schema_status !== FALSE) {
                 // dbSchema inserted, now only update
                 $schema_insert = FALSE;
             }
         } else {
             echo ' Could not open file!' . PHP_EOL;
             // Critical errors, stop update
             logfile('update-errors.log', "====== Schema update " . sprintf("%03d", $db_rev) . " -> " . sprintf("%03d", $filename) . " ==============");
             logfile('update-errors.log', "Error: Could not open file {$filepath}!");
             del_process_info(-1);
             // Remove process info
             exit(1);
         }
     }
 }