Example #1
0
    if ($verbose || $fatal) {
        echo $message . PHP_EOL;
    }
    logger($message);
    if ($fatal) {
        exit(1);
    }
}
//Config.
require_once ".htconfig.php";
//Connect the DB.
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
//Import syncing functions.
require_once 'sync.php';
//Get work for pulling.
$pull_batch = get_pulling_job($a);
//Get work for pushing.
list($push_targets, $push_batch) = get_pushing_job($a);
//Close the connection for now. Process forking and DB connections are not the best of friends.
$db->getdb()->close();
if (count($pull_batch)) {
    run_pulling_job($a, $pull_batch, $db_host, $db_user, $db_pass, $db_data, $install);
}
//Do our multi-fork job, if we have a batch and targets.
if (count($push_targets) && count($push_batch)) {
    run_pushing_job($push_targets, $push_batch, $db_host, $db_user, $db_pass, $db_data, $install);
}
//Log the time it took.
$time = time() - $start_syncing;
msg("Syncing completed. Took {$time} seconds.");