I'm working on a plugin delete script. But there is another way to test this without any script. This video demonstrates what I mean. https://streamable.com/pzc6u First I was unable to rename a phar. Move it to an empty plugins folder made it being able to rename. But in the old plugins folder there was a plugin that is loaded but able to rename (at the end of the video). PHP: #$file instanceof DirectoryIteratorunlink($file->getPathname()); Code: Disabling AutoInv v1.0.0 [Server thread/INFO]: An unknown error occurred while attempting to perform this command [Server thread/CRITICAL]: Unhandled exception executing command 'fcau remove AutoInv' in fcau: unlink(AutoInv.phar): Resource temporarily unavailable [Server thread/CRITICAL]: ErrorException: "unlink(AutoInv.phar): Resource temporarily unavailable" (EXCEPTION)
I'm not sure either but i'll make a wild guest, It's probably that the server has already loaded the phar and i can see the it being disabled but who knows what a server can do and what it can mock.
I've looked into PluginManager and can't find the unloadPlugin() function or anything similar. Do you have any idea what to do for temporary solution?
You are going to get into all kinds of trouble renaming, deleting, or moving phar files while the server is running. For a better solution, take a look at Sheep: https://github.com/KnownUnown/Sheep
I'm not into this form of coding.. The only endpoint I could find is https://github.com/KnownUnown/Sheep/blob/master/src/Sheep/Store/MemoryStore.php#L21 . Can you explain a bit about how it works ?
The author loaded the plugin into an array and then unset it. I don't know how to explain more in depth but that's the main concept.
So Sheep doesn't and it decided to just put the contents into the phar. And it works for me, as long as the plugin has been disabled before putting in new contents.
That's why Sheep does this: https://github.com/KnownUnown/Sheep/blob/master/src/Sheep/SheepPlugin.php#L45-L72