0
0
mirror of https://github.com/pmmp/PocketMine-MP.git synced 2025-04-05 18:54:29 +00:00

29 Commits

Author SHA1 Message Date
38441a6ba3 build: avoid weak comparison 2025-01-07 22:23:16 +00:00
0e5395c59b PocketMine-MP.phar self-extraction to decompressed cache ()
Because ext-phar sucks, tmp gets spammed by cache files for every thread when loading files from the phar on the fly.

Instead, we convert the `.phar` into a decompressed `.tar` in the tmp directory and require files from inside it. Surprisingly, this works because `ext-phar` supports `tar` and `zip` natively. No stream wrapper is required, as the `PocketMine.php` bootstrap loads files relative to its location, so the cache is automatically used for everything.

To be honest I would rather get rid of phars entirely, but they are still the easiest way to have PhpStorm load PocketMine-MP API information for now, and the alternatives are more complicated and inconvenient.

### Caveats
Everywhere that previously used `new Phar(Phar::running(false))` in the core code needs to be updated to use `PharData` for this to work correctly. Plugins don't need to do anything.

### Why not just use `Phar::decompressFiles()`?
This requires setting `phar.readonly` to `0`, which is a security issue. Technically, we could have used a subprocess to do this, but it just didn't seem right.

### WTF? `phar://` can be used on `tar` files???
Yup. I was just as surprised to find out that `require` works in such contexts.

### Relevant issues
- Closes  

## Changes
### API changes
None.

### Behavioural changes
Server startup will be slightly slower, as the phar has to decompress and convert itself into a `.tar`. However, testing showed that this generally takes less than 200 ms, so it should be barely noticeable.

## Backwards compatibility
No BC issues.

## Tests
Locally tested and the CI will also verify
2024-03-18 16:48:17 +00:00
4db38ee452 Updated PHPStan 2024-01-08 16:20:42 +00:00
31465525e3 Fixed PHP-CS-Fixer not import global constants. () 2022-12-12 17:12:33 +00:00
99996b62d6 Align PhpDoc @param tags according to PHP-CS-Fixer 2022-12-06 13:21:20 +00:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
533d3aae8b Merge branch 'stable' 2021-11-26 22:41:18 +00:00
71b813d4f9 Define pocketmine\BUILD_NUMBER from phar metadata
this way we don't have to patch the code (no idea why we were doing that anyway).
2021-11-26 22:27:58 +00:00
5fa4e284bf Merge branch 'stable' 2020-12-27 19:35:27 +00:00
5920b0ba40 Remove _PHPSTAN_ANALYSIS constant
we don't need this anymore since PHPStan is able to intelligently decide whether to autoload a file or not.
2020-12-27 19:10:40 +00:00
d1775b166f Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-11-16 21:35:08 +00:00
50e29a5ed8 build/make-server: bail when composer dev dependencies are installed
these mess up the phar and make it extremely bloated. Almost everyone building for themselves unintentionally includes dev dependencies.
2020-11-16 18:54:07 +00:00
f1fd8a13e9 Merge commit '1fb5043eb1b495e6926caecf3fb493837724c770'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l8-baseline.neon
2020-06-17 20:46:18 +01:00
1fb5043eb1 build/server-phar: fixed a phpstan level 8 error 2020-06-15 23:16:40 +01:00
35be36961d Merge tag '3.11.7' 2020-04-18 11:29:47 +01:00
5f33ef35e3 build: allow providing a git hash 2020-04-09 21:13:54 +01:00
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
fa82cb26d8 added native types to closures (phpstan-strict-rules) 2020-02-05 16:35:10 +00:00
e1eb9186fe Merge branch 'stable' 2020-02-03 19:57:21 +00:00
0e35ee8cb7 build/server-phar: drop unused imports 2020-02-03 11:18:21 +00:00
da5b7f47df build/server-phar: import global functions 2020-02-03 11:17:51 +00:00
afeb9838e4 Merge branch 'stable' 2020-02-02 16:47:19 +00:00
963abb718f 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.
2020-02-02 16:27:38 +00:00
cb16f5c142 Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
96ac95798b Merge commit '4ff4434a220813e446efde4a38e48a0416476dba'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
2020-01-31 20:11:29 +00:00
260ac47588 add some phpstan array types 2020-01-30 22:23:11 +00:00
4ff4434a22 build/server-phar: mark metadata as mixed[] 2020-01-30 21:49:52 +00:00
dd5be9692c Merge commit '5cd7e11b298a35bf796b41b577c28441e41ff411' 2020-01-04 16:24:29 +00:00
08e3b8ffdc build: added specialized script to create a server phar
this is much easier to use than devtools, and allows us to make additional specializations for PM build that would otherwise just be a colossal pain in the ass.
2020-01-04 14:56:53 +00:00