Example #1
0
   frontend/tool for this.
*/
// define("SYNC_URL", "wikisync://example.net/ewiki/tools/t_sync.php");
#-- go
if (defined("SYNC_URL")) {
    $proto = "sync";
    $url = SYNC_URL;
    if (!function_exists("xmlrpc")) {
        include "plugins/lib/xmlrpc.php";
    }
    if (!function_exists("phprpc")) {
        include "plugins/lib/phprpc.php";
    }
    if (!function_exists("ewiki_sync_local")) {
        include "plugins/lib/sync.php";
    }
    #-- check connection
    if ($rlist = ewiki_sync_remote("::LIST")) {
        $locall = ewiki_sync_local("::LIST");
        echo "[{$cron}]: " . count($llocal) . " pages here, " . count($rlist) . " remotely\n";
        #-- 1
        echo "[{$cron}]: downloading from {$url}\n";
        ewiki_sync_start("download", $rlist, $locall, "ewiki_sync_remote", "ewiki_sync_local");
        #-- 2
        echo "[{$cron}]: uploading from {$url}\n";
        ewiki_sync_start("upload", $llocal, $rlist, "ewiki_sync_local", "ewiki_sync_remote");
        echo "[{$cron}]: done\n";
    } else {
        echo "[{$cron}]: No connection to {$url}\n";
    }
}
Example #2
0
 $sync = $action == "sync";
 $correct = 1;
 #-- info
 echo "<i>info</i>: " . count($locall) . " pages found in local Wiki database<br>\n";
 echo "&nbsp; &nbsp; &nbsp; and " . count($rlist) . " are on remote server<br>\n";
 echo "\n\n";
 flush();
 #-- upload
 if (in_array($action, array("upload", "sync", "exact"))) {
     echo "<br>\n<h3>upload</h3>\n";
     ewiki_sync_start("upload", $ls_local, $ls_remote, "ewiki_sync_local", "ewiki_sync_remote");
 }
 #-- download
 if (in_array($action, array("download", "sync", "exact"))) {
     echo "<br>\n<h3>download</h3>\n";
     ewiki_sync_start("download", $ls_remote, $ls_local, "ewiki_sync_remote", "ewiki_sync_local");
 }
 #-- do an in-deepth analyzation of remaining files
 if ($action == "exact") {
     echo "<br>\n<h3>sync - exact comparison</h3>\n";
     foreach ($ls_local as $id => $ver) {
         if ($ls_remote[$id] == $ver) {
             echo htmlentities($id);
             flush();
             $L = ewiki_sync_local("::GET", array($id));
             $R = ewiki_sync_remote("::GET", array($id));
             if (!ewiki_sync_half_identical($L, $R)) {
                 echo " - conflict";
             } else {
                 echo " - ok";
             }