more ausbudget import
[disclosr.git] / admin / importDirectoryUUIDs.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
<?php
 
// http://gold.gov.au/reports/department/index.xml
require_once '../include/common.inc.php';
$db = $server->get_db('disclosr-agencies');
$rows = $db->get_view("app", "byName")->rows;
$nametoid = Array();
$sums = Array();
foreach ($rows as $row) {
    $nametoid[trim($row->key)] = $row->value;
}
 
if (file_exists('index.xml')) {
    $xml = simplexml_load_file('index.xml');
 
    foreach ($xml as $agency) {
        $names = Array();
        $names[] = "".$agency->name;
        
        if (isset($agency->shortName)) {
             $names[] = "".$agency->shortName;
        }
       foreach ($names as $name) {
           if (!in_array($name, array_keys($nametoid))) {
               echo "$name missing".PHP_EOL;
               print_r($names);
               echo $agency->dn;
               echo PHP_EOL;
               echo PHP_EOL;
           }
       }
    }
} else {
    exit('Failed to open test.xml.');
}
?>