General developer forum

I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.

 
Picture of Lawrence Lagerlof
I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
 

I am developing a webservice plugin directly in "/local/myplugin/", and everything is working, but currently when I need to test some changes I need to uninstall and install the plugin. This is very unproductive because everytime I need to set the functions to my service.

This is the normal workflow for developing Moodle plugins, or exist a better way?

 
Average of ratings: -
Picture of Merddyn Sheeley
Re: I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
 

I don't know if this is the best way to speed things up, but you can speed things up a little by incrementing the version number in a version.php file and then installing the plugin. It at least saves the time of uninstalling it.

Might also help to have a shortcut/bookmark/tab to open the install page faster. If you're on Windows, you can create a shortcut to the webpage on your desktop, and then right click it, select properties, and set a key combination to run that shortcut, so you could at least open that page with a three key combo instead, as well.


...


If there are faster means, I'd also like to know!

 
Average of ratings: -
Davo
Re: I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
Core developersParticularly helpful MoodlersPlugin developers

It really depends what sort of changes you are making.

If you're changing the database definition, then the XMLDB editor (which you should always use to generate the install.xml file) can also generate statements to go in the upgrade.php file - so just put them in there, bump the version number and visit the notifications page, to run the upgrade.

If you're changing capability definitions, message providers, event handlers or any of the other definitions that sit inside the db/ subdirectory, then just bump the version number and visit the notifications page.

If you're changing language strings or styles, then purge caches (site admin > developer > purge caches) OR, if you can run command line scripts, "php admin/cli/purge_caches.php" (which I run a lot during development).

If it's just a change in the code itself (which doesn't require a change to the database structure or the caches), then just save the changes (assuming you are working with a local server, if it is a remote server you'll need to upload them as well) and refresh the page - the changes should appear immediately.

 
Average of ratings: Useful (11)
Picture of Mark Johnson
Re: I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
Core developersParticularly helpful MoodlersPlugin developers
Just one other thing to add, if you do genuinely want to check that the plugin installs correctly, if you set up PHPUnit or Behat testing, running the init.php script after bumping the version number will drop the testing database and reinstall the whole system in one command.
 
Average of ratings: -
Picture of Rachel Martin
Re: I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
 

I agree here.  I rarely have to reinstall a plugin to update it.  Just update your code, save the changes, and purge the cache.

 
Average of ratings: -
Picture of Lawrence Lagerlof
Re: I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
 

You helped me a lot. Thank you.

 
Average of ratings: -
Picture of Christie Trent
Re: I am developing a plugin, but reinstall it everytime to test it is too much time-consuming.
 

I agree with the previous reply.  I am currently working on a plugin as well for a Syllabus.  I currently change the version number and then I am prompted to update the plugin.  To my understanding, you do not need to uninstall it.  I may changes to the PHP files of my plugin and just refresh the page to see some changes.

 
Average of ratings: -