changed git call from https to git readonly
[atutor.git] / mods / wiki / tools / cron.d / S53sync.php
1 <?php
2 /*
3    This script simply calls the WikiSync backend for a given sync URL.
4    It is probably rarely useful, and you should rather use the standalone
5    frontend/tool for this.
6 */
7
8 // define("SYNC_URL", "wikisync://example.net/ewiki/tools/t_sync.php");
9
10
11 #-- go
12 if (defined("SYNC_URL")) {
13
14    $proto = "sync";
15    $url = SYNC_URL;
16    if (!function_exists("xmlrpc")) include("plugins/lib/xmlrpc.php");
17    if (!function_exists("phprpc")) include("plugins/lib/phprpc.php");
18    if (!function_exists("ewiki_sync_local")) include("plugins/lib/sync.php");
19
20    #-- check connection
21    if ($rlist = ewiki_sync_remote("::LIST")) {
22       $locall = ewiki_sync_local("::LIST");
23       echo "[$cron]: ".count($llocal)." pages here, ".count($rlist)." remotely\n";
24       
25
26       #-- 1
27       echo "[$cron]: downloading from $url\n";
28        ewiki_sync_start(
29           "download",
30           $rlist, $locall,
31           "ewiki_sync_remote", "ewiki_sync_local"
32        );
33
34       #-- 2
35       echo "[$cron]: uploading from $url\n";
36        ewiki_sync_start(
37           "upload",
38           $llocal, $rlist,
39           "ewiki_sync_local", "ewiki_sync_remote"
40        );
41
42       echo "[$cron]: done\n";
43    }
44    else {
45       echo "[$cron]: No connection to $url\n";
46    }
47
48 }
49
50
51 ?>