diff options
| author | moehm | 2014-04-28 11:12:43 +0200 |
|---|---|---|
| committer | moehm | 2014-04-28 11:12:43 +0200 |
| commit | 760c31261d5c045c8e22461c3c3815e3cdd74a8b (patch) | |
| tree | 88c7fd5b66f2726e840d2f028eaa55ba28975bc8 /www/check.hash.php | |
| parent | 7c1299521f31d6eb733e29455ccad8c92cbc0a7b (diff) | |
| parent | d0857bc2803f3c223d7331c8770aedcbc4b310a2 (diff) | |
| download | files.iamfabulous.de-760c31261d5c045c8e22461c3c3815e3cdd74a8b.tar.gz | |
Merge branch 'master' of git.iamfabulous.de:files.iamfabulous.de
Diffstat (limited to 'www/check.hash.php')
| -rw-r--r-- | www/check.hash.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/www/check.hash.php b/www/check.hash.php new file mode 100644 index 0000000..2149355 --- /dev/null +++ b/www/check.hash.php @@ -0,0 +1,35 @@ +<?php + +$db = new SQLite3("../database/sqlite.db"); + +//$hash_db = $db->query("SELECT count(hash) FROM (SELECT DISTINCT hash FROM files WHERE folder='FILE')"); +$hash_db = $db->query("SELECT hash FROM (SELECT DISTINCT hash FROM files WHERE folder='FILE')"); +$file_name = array_diff(scandir("../files/"), array(".", "..", "README")); +$ar_key = array_keys($file_name); +$file = array(); + +$cnt=0; + +while($hash_ar = $hash_db->fetchArray(SQLITE3_NUM)){ + $res[$count] = $hash_ar[0].".gz"; + $count++; +} + +echo "Checking for leftover hashs in dir... <br>"; +for($i=0;$i<count($ar_key); $i++){ + if(!in_array($file_name[$ar_key[$i]], $res)){ + $file[$cnt] = $file_name[$ar_key[$i]]; + $cnt++; + } +} + +var_dump($file); + +echo "<br><br> Checking for leftover hashs in database... <br>"; + +foreach($file_name as $file){ + if(!in_array($res, $file)){ + echo "<br>"; + echo $file; + } +} |
