mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
build/server-phar: compress using gzip (except stub)
this produces a 75% reduction in phar size, at the expense of a slight degradation of autoloading speed and needing a writable tmpdir.
This commit is contained in:
parent
1f2fb73297
commit
963abb718f
@ -104,14 +104,9 @@ function buildPhar(string $pharPath, string $basePath, array $includedPaths, arr
|
|||||||
yield "Added $count files";
|
yield "Added $count files";
|
||||||
|
|
||||||
if($compression !== null){
|
if($compression !== null){
|
||||||
yield "Checking for compressible files...";
|
yield "Compressing files...";
|
||||||
foreach($phar as $file => $finfo){
|
$phar->compressFiles($compression);
|
||||||
/** @var \PharFileInfo $finfo */
|
yield "Finished compression";
|
||||||
if($finfo->getSize() > (1024 * 512)){
|
|
||||||
yield "Compressing " . $finfo->getFilename();
|
|
||||||
$finfo->compress($compression);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$phar->stopBuffering();
|
$phar->stopBuffering();
|
||||||
|
|
||||||
@ -137,7 +132,23 @@ function main() : void{
|
|||||||
[
|
[
|
||||||
'git' => $gitHash
|
'git' => $gitHash
|
||||||
],
|
],
|
||||||
'<?php require("phar://" . __FILE__ . "/src/pocketmine/PocketMine.php"); __HALT_COMPILER();'
|
<<<'STUB'
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$tmpDir = sys_get_temp_dir();
|
||||||
|
if(!is_readable($tmpDir) or !is_writable($tmpDir)){
|
||||||
|
echo "ERROR: tmpdir $tmpDir is not accessible." . PHP_EOL;
|
||||||
|
echo "Check that the directory exists, and that the current user has read/write permissions for it." . PHP_EOL;
|
||||||
|
echo "Alternatively, set 'sys_temp_dir' to a different directory in your php.ini file." . PHP_EOL;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
require("phar://" . __FILE__ . "/src/pocketmine/PocketMine.php");
|
||||||
|
__HALT_COMPILER();
|
||||||
|
STUB
|
||||||
|
,
|
||||||
|
\Phar::SHA1,
|
||||||
|
\Phar::GZ
|
||||||
) as $line){
|
) as $line){
|
||||||
echo $line . PHP_EOL;
|
echo $line . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user