"ext-simplexml": "*",
"ext-json": "*",
"ext-iconv": "*",
+ "ext-sodium": "*",
"laravel/framework": "~5.8|^6.0|^7.0|^8.0",
"cubist/net": "dev-master",
- "ext-sodium": "*",
"dpb587/microdata-dom": "dev-master"
}
}
return $res;
}
+ /**
+ * @param $path
+ * @param $recursive
+ * @param $recursiveMode
+ * @return \SplFileInfo[]|\DirectoryIterator|\RecursiveIteratorIterator
+ */
public static function getDirectoryIterator($path, $recursive = false, $recursiveMode = \RecursiveIteratorIterator::SELF_FIRST)
{
if ($recursive) {
$path = realpath($path);
if (!file_exists($path)) {
- return array();
+ return [];
}
return new \DirectoryIterator($path);
}
return $time;
}
+ public static function checkHashDir($dir)
+ {
+ $nb = 0;
+ $time = 0;
+ $size = 0;
+
+ $files = self::getDirectoryIterator($dir, true);
+
+ foreach ($files as $f) {
+ $time = max($time, $f->getMTime());
+ $nb++;
+ $size += $f->getSize();
+ }
+
+ return hash('sha256', $dir . '$$' . $nb . '//' . $size . '|||' . $time);
+ }
+
/**
* @param ...$files string
* @return string|null