Compare commits

..

5 Commits

Author SHA1 Message Date
Pavel Shevaev 4361e7579e Gradually migrating to iterable instead of arrays
Publish PHP Package / docker (push) Successful in 8s Details
2025-03-06 13:20:59 +03:00
Pavel Shevaev 616c2c46d1 Fixing names_hash_changed(..) so that it writes hex summ instead of binary one
Publish PHP Package / docker (push) Successful in 6s Details
2025-01-21 17:38:28 +03:00
Pavel Shevaev 720d851a23 Обновить CHANGELOG.md 2024-12-18 18:50:13 +03:00
Pavel Shevaev 9ad9c3acce Добавить CHANGELOG.md 2024-12-18 18:49:29 +03:00
wrenge fd241509a5 Revert dir need regen support
Publish PHP Package / docker (push) Successful in 8s Details
2024-12-18 08:06:04 +03:00
2 changed files with 11 additions and 14 deletions

5
CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
## v1.8.1
- Adding null check in need_to_regen_any(..)
## v1.7.2
- Fixing weird lstat bug on Windows for rrmdir function for large amount of directory items

View File

@ -87,8 +87,6 @@ function find_files(string $dir, array $fnmatch_patterns = []) : array
return $results; return $results;
} }
//obsolete, use find_files instead
function scan_files_rec(array $dirs, array $only_extensions = [], int $mode = 1) : array function scan_files_rec(array $dirs, array $only_extensions = [], int $mode = 1) : array
{ {
$files = array(); $files = array();
@ -168,23 +166,17 @@ function json_make_pretty(string $json) : string
return prettyJSON($json); return prettyJSON($json);
} }
function need_to_regen(string $file, array $deps, bool $debug = false) : bool function need_to_regen(string $file, iterable $deps, bool $debug = false) : bool
{ {
if(is_file($file)) if(!is_file($file))
{
$fmtime = filemtime($file);
}
else if(is_dir($file))
{
$fmtime = filectime($file);
}
else
{ {
if($debug) if($debug)
echo "! $file\n"; echo "! $file\n";
return true; return true;
} }
$fmtime = filemtime($file);
foreach($deps as $dep) foreach($deps as $dep)
{ {
if($dep && is_file($dep) && (filemtime($dep) > $fmtime)) if($dep && is_file($dep) && (filemtime($dep) > $fmtime))
@ -1201,12 +1193,12 @@ function are_you_sure_ask() : bool
return $resp == "YES"; return $resp == "YES";
} }
function names_hash_changed(string $crc_file, array $names) : bool function names_hash_changed(string $crc_file, iterable $names) : bool
{ {
$ctx = hash_init('crc32'); $ctx = hash_init('crc32');
foreach($names as $name) foreach($names as $name)
hash_update($ctx, $name); hash_update($ctx, $name);
$names_crc = hash_final($ctx, true); $names_crc = hash_final($ctx, false);
$changed = !file_exists($crc_file) || ensure_read($crc_file) != $names_crc; $changed = !file_exists($crc_file) || ensure_read($crc_file) != $names_crc;
ensure_write($crc_file, $names_crc); ensure_write($crc_file, $names_crc);
return $changed; return $changed;