1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved How to reload code of plugin without restarting server?

Discussion in 'Development' started by Yexeed, Dec 2, 2017.

  1. Yexeed

    Yexeed Slime

    Messages:
    76
    So, is it possible to reload code of plugin without stop\start server?
    Example:
    I have code:
    PHP:
    function onEnable(){
            
    $this->getLogger()->info("test1");
        }
    after enabling output will be:
    Code:
    [Server thread/INFO]: [TESTPLUG] test1
    then i change
    Code:
    $this->getLogger()->info("test1");
    to
    Code:
    $this->getLogger()->info("test 234");
    and save it
    and then i will make reload of server, and the output still will be:
    Code:
    [Server thread/INFO]: [TESTPLUG] test1
    but after stop then start output will be new:
    Code:
    [Server thread/INFO]: [TESTPLUG] test 234
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    You can't. Period.

    There are some very hacky PHP extensions to allow unloading previously loaded code and loading it again, but this will cause a lot of side effects. What's wrong with restarting the server?
     
    jasonwynn10 likes this.
  3. Yexeed

    Yexeed Slime

    Messages:
    76
    I don't need it anyway, just asking if it's possible and I don't have to restart the server every time I make my edits in the plugin
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    It's more reliable to test things by restarting the whole server. There may be something left over from the previous version if you don't restart the servre.
     
    Jack Noordhuis likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.