better date parser
[disclosr.git] / admin / conflicts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
 
include_once('../include/common.inc.php');
include_header('Fix Conflicts');
                require_once '../lib/php-diff/lib/Diff.php';
                require_once '../lib/php-diff/lib/Diff/Renderer/Html/SideBySide.php';
 
$db = $server->get_db('disclosr-agencies');
 
try {
    $rows = $db->get_view("app", "getConflicts", null, true)->rows;
    //print_r($rows);
    foreach ($rows as $row) {
echo "<h2>".$row->id."</h2>";
$request = Requests::get($serverAddr."disclosr-agencies/".$row->id);
$origSort = object_to_array(json_decode($request->body));
ksort($origSort);
    $origDoc = explode(",",json_encode($origSort));
        foreach($row->value as $conflictRev) {
$conflictURL = $serverAddr."disclosr-agencies/".$row->id."?rev=".$conflictRev;
$request = Requests::get($conflictURL);
$conflictSort = object_to_array(json_decode($request->body));
ksort($conflictSort);
    $conflictDoc = explode(",",json_encode($conflictSort));
echo "curl -X DELETE ".$conflictURL."<br>".PHP_EOL;
                // Options for generating the diff
                $options = array(
                        //'ignoreWhitespace' => true,
                        //'ignoreCase' => true,
                );
 
                // Initialize the diff class
                $diff = new Diff($conflictDoc, $origDoc, $options);
 
                // Generate a side by side diff
                $renderer = new Diff_Renderer_Html_SideBySide;
                echo $diff->Render($renderer);
}
die();
        
    }
} catch (SetteeRestClientException $e) {
    setteErrorHandler($e);
}
 
include_footer();
?>