Difference between revisions of "Making changes show up during development"
(→Changing web services (db/services.php))
m (TimHunt moved page Making changes show up during Moodle development to Making changes show up during development without leaving a redirect)
Revision as of 16:43, 26 March 2019
Sometime, when you are trying to do Moodle development, you edit the code, and nothing seems to change as a result. This is because, to improve performance, Moodle now has all sorts of caching built in. When this is happening, this page will try to give you the quickest way to make your changes show up in all situation.
However, this page is still quite new, so please help build it.
- 1 General advice
- 2 Changes in the Moodle and Moodle plugins
- 2.1 Changing PHP (*.php)
- 2.2 Adding or removing an auto-loaded class
- 2.4 Changing CSS (*.css)
- 2.5 Changing SCSS/LESS (*.scss/*.less)
- 2.6 Changing language strings (lang/en/type_plugin.php)
- 2.7 Changing capabilities (db/access.php)
- 2.8 Changing scheduled tasks (db/tasks.php)
- 2.9 Changing web services (db/services.php)
- 2.10 Changing database strucutre (db/install.xml, db/upgrade.php)
- 2.11 Adding a new PHPunit test
- 2.12 Adding a new Behat test
- 3 Changes in mobile support for plugins
- 4 Changes in the Moodle mobile app
- If in doubt, visit http://your.domain/moodle/admin to check that the Moodle install is up-to-date.
- And then http://your.domain/moodle/vle/admin/purgecaches.php and click the 'Purge all caches' button. This will slow things down for the next few requests, until the caches have re-populated.
- Depending on what you changed in your plugin, then in addition to the above, you may need to remember to increase the version number in version.php, or the changes will not show up.
- You may have forgotted to run grunt.
- If you have just added a new Behat or PHPunit test, you may need to re-run admin/tool/.../cli/init.php.
The above steps are a brute force approach. They will probably work, but are probably not the fastest way. Below, we list for all the various type of change you can make, the most efficient way to make the change show up.
Changes in the Moodle and Moodle plugins
Changing PHP (*.php)
You should just need to press reload (F5) in your browser.
Adding or removing an auto-loaded class
If you get class-not-found errors, you need to visit http://your.domain/moodle/admin.
If JS caching is on, you need to re-run grunt. (Do you also need to purge a cache??? I don't think so.)
Changing CSS (*.css)
Changing SCSS/LESS (*.scss/*.less)
Changing language strings (lang/en/type_plugin.php)
Changing capabilities (db/access.php)
Changing scheduled tasks (db/tasks.php)
Changing web services (db/services.php)
Changing database strucutre (db/install.xml, db/upgrade.php)
Adding a new PHPunit test
Adding a new Behat test
You need to re-run
or any newly-added *.feature file will not be found.
Changes in mobile support for plugins
Note, these steps were originally written by people mostly on question type plugins. Hopefully they are generally applicable, but if they don't make sense in your case, that might be why. Please edit to improve them.
General note it you are seeing a lot of errors
- In browser developer tools, go to Application -> Clear storage.
- Close the browser, and re-launch.
Adding mobile support to a plugin for the first time
- Bump the plugin version number.
- Go to admin -> Notifications.
- F5 in the app to restart.
Change in existing template (mobile/*.html)
Just pull down in the app to refresh.
Adding a new template (mobile/*.html)
Press F5 in the browser developer tools to restart the app.
===Change to server-side classes/output/mobile.php - ???
- bump version number in db/mobile.php
- purge caches (specifically the tool_mobile/plugininfo MUC cache)
- Press F5 to restart the app.
Changes in the Moodle mobile app