mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-19 22:47:59 +00:00
fixes #56 and added tool to recalculate all hashes
This commit is contained in:
24
tools/recreate_hashlist.php
Normal file
24
tools/recreate_hashlist.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
define('ROOT', dirname(__FILE__).DS.'..');
|
||||
|
||||
echo "[i] Starting recreation of hashes.csv\n";
|
||||
|
||||
$dir = ROOT.DS.'upload'.DS;
|
||||
$dh = opendir($dir);
|
||||
|
||||
$fp = fopen($dir.'hashes.csv','w');
|
||||
if(!$fp)
|
||||
exit("[X] Can't open hashes.csv to write");
|
||||
|
||||
while (false !== ($hash = readdir($dh))) {
|
||||
$img = $dir.$hash.DS.$hash;
|
||||
if(!file_exists($img) || $hash=='.' || $hash=='..') continue;
|
||||
echo " [s] Calculating $hash\n";
|
||||
$sha1 = sha1_file($img);
|
||||
fwrite($fp,"$sha1;$hash\n");
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "[i] Finished\n";
|
||||
Reference in New Issue
Block a user