1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-16 13:48:58 +01:00

[ticket/16543] Add script for automate it on builds

PHPBB3-16543
This commit is contained in:
3D-I 2020-07-08 23:19:12 +02:00 committed by Marc Alexander
parent 87dfa9a061
commit 80a6a58a84
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -37,9 +37,9 @@ function patch_file(string $filepath): void
$old = $file;
$new = preg_replace_callback(
'(^@import\\s+url\\([\'"](?<basename>\\w++\\.css)\\?\\K(?:hash|v)=[^\'"]++)m',
function ($m) use ($filepath)
function ($match) use ($filepath)
{
$path = dirname($filepath) . DIRECTORY_SEPARATOR . $m['basename'];
$path = dirname($filepath) . DIRECTORY_SEPARATOR . $match['basename'];
$hash = sprintf('%08x', crc32(file_get_contents($path)));
return 'hash=' . $hash;