34 Commits

Author SHA1 Message Date
Dylan K. Taylor
c2918709a3
Merge branch 'next-minor' into next-major 2023-01-06 01:59:04 +00:00
Alexey
172ce659b8
Use str_starts_with, str_ends_with and str_contains instead of strpos (#5485) 2022-12-31 13:02:23 +00:00
Dylan K. Taylor
c89df7eb1c
Merge remote-tracking branch 'origin/next-minor' into next-major 2022-12-25 18:22:13 +00:00
Dylan K. Taylor
0d169b4e80
Filesystem: added fileGetContents to reduce ErrorToExceptionHandler boilerplate code 2022-12-25 17:13:51 +00:00
Dylan K. Taylor
4d79aced07
Merge branch 'next-minor' into next-major 2022-12-15 19:50:27 +00:00
Dylan K. Taylor
b5e6dec0c6
Filesystem: capture error information from attempted lock file creation 2022-12-06 14:06:08 +00:00
Dylan K. Taylor
fdb07cdbcd
Added more missing native types according to 8.0 standards 2022-11-23 14:21:38 +00:00
Dylan K. Taylor
7bcc663b60
Migrate core code to using symfony/filesystem
webmozart/path-util is retained for plugin compatibility, but is dropped in 5.0
2022-10-14 21:51:29 +01:00
Dylan K. Taylor
f88ae93897
BC break: Replaced webmozart/path-util with symfony/filesystem, closes #5332 2022-10-13 16:43:36 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
0e7e776862
Modernize property declarations in src/utils 2022-04-28 13:12:12 +01:00
Dylan K. Taylor
282b430b1f
Replace disallowed operators in src/utils/ 2022-01-20 19:02:26 +00:00
Dylan K. Taylor
a5c0958adf
Filesystem::safeFilePutContents() now consistently throws RuntimeException in all expected failure cases
unexpected cases may still throw ErrorException (such as undefined variables) but we don't want to capture those.
2022-01-09 16:33:31 +00:00
Dylan K. Taylor
fd880d8465
Filesystem: Use ErrorToExceptionHandler to improve error output 2022-01-09 16:26:42 +00:00
Dylan K. Taylor
e04dfe96af
Merge branch 'stable' into next-minor 2022-01-01 17:55:17 +00:00
Dylan K. Taylor
38b6b39cb3
Filesystem: workaround a stupid Windows issue in safeFilePutContents()
occasionally Windows will randomly decide to deny us access to rename the file for no reason whatsoever. If this happens, we attempt an old-style copy and delete.
If the rename failed for a legit reason, the copy and delete should also fail and generate an error message. If it was Windows being a spaz, it should work normally without errors.
2021-12-29 15:26:34 +00:00
Dylan K. Taylor
889d048ca3
Make use of Utils::assumeNotFalse() in a bunch of places
I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
2021-12-08 19:39:04 +00:00
Dylan K. Taylor
8e37f86480
Avoid file_put_contents() when overwriting files
this fixes many cases of corruption during disk-full situations - file_put_contents() would write an empty file, destroying the original data.
fixes #3152
2021-12-05 00:26:48 +00:00
Dylan K. Taylor
269231c228
Ban foreach(arrayWithStringKeys as k => v)
this is not as good as phpstan/phpstan-src#769 (e.g. array_key_first()/array_key_last() aren't covered by this, nor is array_rand()) but it does eliminate the most infuriating cases where this usually crops up.
2021-11-15 22:52:05 +00:00
Dylan T
32d7b1e6af
Start using webmozart/pathutil for joining paths (#4287) 2021-06-29 19:40:43 +01:00
Dylan K. Taylor
43f71d0d63
FormatConverter: Copy worlds for backup if rename fails
this can fail if the backups directory points to a different drive than the original worlds location. In this case, we have to copy and delete the files instead, which is much slower, but works.
I REALLY advise against putting backups on a different mount point than worlds if you plan to convert large worlds.
2021-06-17 20:46:34 +01:00
Dylan K. Taylor
dff13a884f
Merge branch 'stable' 2021-02-12 17:34:25 +00:00
Dylan K. Taylor
5f4ef84d52
Clean up imports 2020-12-12 19:48:00 +00:00
Dylan K. Taylor
d39348929f Removed PLUGIN_PATH constant 2020-12-09 20:48:50 +00:00
Dylan K. Taylor
ff6672ba85 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/utils/Utils.php
2020-12-09 20:27:19 +00:00
Dylan K. Taylor
22c8bdeeeb Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/CrashDump.php
#	src/utils/Utils.php
2020-12-09 01:47:05 +00:00
Dylan K. Taylor
a8180cdf0b Merge commit 'df76c02e7ac3bfbde8ecb597653779e8e1516f58'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-26 19:14:25 +01:00
Dylan K. Taylor
5b7a55660f Merge commit '786f416f2ef31726b9e6fa0a5edde36aecddf085'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/utils/Utils.php
2020-05-19 21:19:44 +01:00
Dylan K. Taylor
163c3855eb Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/plugin/PluginDescription.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/rcon/RCON.php
#	src/pocketmine/network/rcon/RCONInstance.php
#	src/pocketmine/scheduler/AsyncTask.php
#	src/pocketmine/tile/Spawnable.php
#	src/scheduler/AsyncPool.php
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/UUID.php
#	src/utils/Utils.php
#	src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
9c06c1a06f Merge branch 'stable' 2020-01-11 22:36:57 +00:00
Dylan T
d456cb2419
Filesystem: added some documentation for createLockFile() and releaseLockFile()
[ci skip]
2019-10-07 10:03:29 +01:00
Dylan K. Taylor
6e692d76d5 make lock-file code more reusable 2019-08-25 18:50:33 +01:00
Dylan K. Taylor
3eea2442a7 move filesystem-related functions to pocketmine\utils\Filesystem 2019-08-25 17:36:50 +01:00