Create packer with recursive inclusion and deduplication

This commit is contained in:
Tim
2025-03-18 23:31:28 +01:00
parent c4845ed7c6
commit 61a4dcd370
11 changed files with 108 additions and 11 deletions

View File

@ -1,6 +1,10 @@
#!/usr/bin/env php
<?php
/**
* Very simple script, recursively parses a PHP file replacing all includes with the file, no deduplication
*/
function line(string $text): void
{
echo $text . PHP_EOL;
@ -57,7 +61,7 @@ $lines = replaceIncludes($fromFile);
$toFileHandle = fopen($toFile, 'w');
foreach ($lines as $line) {
fwrite($toFileHandle, $line);
chmod($toFile, 0755);
chmod($toFile, fileperms($fromFile));
}
fwrite($toFileHandle, PHP_EOL);
fclose($toFileHandle);