diff --git a/graph-explorer-sites-list-compare.php b/graph-explorer-sites-list-compare.php new file mode 100755 index 0000000..a2938d6 --- /dev/null +++ b/graph-explorer-sites-list-compare.php @@ -0,0 +1,69 @@ +#!/usr/bin/php + $i){ // remove begining of vdb path (keeps clean) + $rootDir[$h] = str_replace("sites_null_", "", str_replace(".json", "", str_replace($folder, "", $i))); + //echo "Reading: ".$rootDir[$h]."\n"; + + $jsonFile = file_get_contents($i); + $jsonContents = json_decode($jsonFile, true); + + foreach($jsonContents as $j){ + foreach($j as $k){ + //echo " ".$k['name']." -> ".$k['webUrl']."\n"; + $shortname[$k['name']] = $k['webUrl']; + $rarw[$k['name']][] = $rootDir[$h]; + } + //print_r($j); + } +} +echo "Files: ".sizeof($rootDir)."\n"; + +foreach($shortname as $short => $long){ + $lenToShow = 120; + if(strlen($long)<$lenToShow) + $long = str_pad($long, $lenToShow, "-"); + echo substr($long, 0, $lenToShow)." -> "; + + //print_r($rarw[$short]); + foreach($rarw[$short] as $shortname => $username){ + echo $username." "; + + } + echo "\n"; +} + + + + + + + +function getDirContents($dir, $filter = '', &$results = array()) { + $files = scandir($dir); + + foreach($files as $key => $value){ + $path = realpath($dir.DIRECTORY_SEPARATOR.$value); + + if(!is_dir($path)) { + if(empty($filter) || preg_match($filter, $path)) $results[] = $path; + } elseif($value != "." && $value != "..") { + getDirContents($path, $filter, $results); + } + } + + return $results; +} + +?> \ No newline at end of file