I have developed a new plugin, that worked fine... To extend I added some functionality to access tags, for that I added this line:
require_once (__DIR__ . '../../../tag/clasess/tag.php');
As you can see I have a typo there... It is obvious that I can fix the code, but what I was wondering about is... What if that code was released to the wild and installed by some innocent user, with no access to the server (via UI)...
In my case moodle keeps displaying a fatal error, that prevents ANY action via the UI...
Fatal error: require_once(): Failed opening required '/var/www/sites/moodle-server.openapp.co.il/iaa/local/ws_rashim../../../tag/clasess/tag.php' (include_path='/var/www/sites/moodle-server.openapp.co.il/iaa/lib/zend:/var/www/sites/moodle-server.openapp.co.il/iaa/lib/pear:.:/usr/share/pear:/usr/share/php') in /var/www/sites/moodle-server.openapp.co.il/iaa/local/ws_rashim/locallib.php on line 7
There is any way to fix it without access to the server?
unfortunately no; that's the reason why:
- people using 3rd party plug-ins should test each (new version of a) plug-in in a separate environment, closest to their production settings and data (ideally, a clone being kept aligned)
- developers should start using a CI environment like Travis to test their plug-in, at least the installation stage: https://docs.moodle.org/dev/Travis_integration. Then, apply the (new version of the) plug-in release to the Moodle Plug-ins Directory
And to add (the slightly obvious) to Matteo's comments, developers should add plenty of phpunit tests. In fact that might be something to add to a checklist of should is this a good plugin checkboxery, i.e. does it have plenty of Unit tests. It is not just about testing, it is about documenting. Tests document the expected behaviour.