Plugins can still attempt to create a new object of a class that hasn't been loaded unless it is disabled.
Wait wait wait. Why can't we just delete the phar file, restart the server, install the new phar, and restart the server?
Then make sure all plugins that need updates are disabled before you update them and either shut down the server or update the plugins when the server is shutting down.
Why restart the server 3 times just to install 1 plugin? You'd be better off disabling the plugins, updating them then restarting the server. A plugin cannot create new instances after it it disabled so it won't be able to cause any problems.
Deleting the phar file and editing the phar file is the same business. And you have to ensure that the server automatically restarts. Otherwise you have to make the owner manually start the server twice.
Wait this could work, couldn't it @SOFe ? I mean just disable the plugin(s) update and restart, right?
This is unreliable. Nobody knows what happens. Even if the plugin is disabled, its code still in PHP's memory. Nobody knows if PHP would do weird stuff and suddenly loads the classes required by the code. For example, what if an AsyncTask is executing? Disabling the plugin doesn't promise its AsyncTasks will stop executing. Edit: to be precise, in the current PocketMine implementation, you can't even know if there is an AsyncTask from the plugin run. You can detect the class loader for the AsyncTask running, but what if the AsyncTask is actually from a dependency plugin that is not disabled? There are too many possibilities that you must not neglect. As the comic above says, just don't do that. I don't want to see velociraptors in a server.
Yes. A shell script, a batch script, a native program, a .jar, a .phar, etc. Anything that is not in the context of "inside a PocketMine server".
It may not be 100% safe but it's the safest way possible using only a plugin. A developer should always write their plugins to handle it's AsyncTask's knowing that it's code might be executed after the plugin is disabled.
Entirely up to you. I for one wouldn't trust other developers to always perform the required checks in their asynctasks so you'd be safer going with @SOFe's method but it would mean your users would need to know how to install more than a plugin (unless you get the plugin to automatically install the updating scripts/program).
Umm i am quite confusing where this thread have gone so are we making a plugin that interface with poggit web api OR make a plugin that interface your own plugin repo?
I'm talking about the AsyncTask body, not the onCompletion() method. An AsyncTask has the right to load a class in the onRun() method. And AsyncTask can't immediately know that a plugin is disabled. There must be a slight delay, and I don't think anyone would really bother to check it between every two statements in an AsyncTask. Just make a plugins.cmd/plugins.sh and a PoggitManager.phar, and all are settled. Poggit. Look at the poll.
How could a .phar be used? I can make it a .php file but I don't know how to make the .phar interact with the CL.