Developing a plugin for moodle ( moodle 3.6)

Developing a plugin for moodle ( moodle 3.6)

by hajar zankadi -
Number of replies: 9

Hello everyone

I hope you are doing very well

I just started developing a plugin ( course format plugin) as many of you advised me to get started by copying a standard plugin elements ( in my case it was topics)

Now I have a question , i did a few changes and I want to test those changes, when i go to "site administration-> notification) i have no message alerting me for an upgrade ( is that normal ) where should I check ? 

is there a process for checking the plugin ( I have installed the check code plugin and enabled the developer debugging)

also, if there is any other advice that will help me during the process of development, they are very welcome

Thank you in advance


Average of ratings: -
In reply to hajar zankadi

Re: Developing a plugin for moodle ( moodle 3.6)

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This depends on what you are changing. Most PHP code changes will be reflected immediately. If you make changes to anything in your plugin's db folder, you'll need to bump the version number in your version.php file and go to "Site administration > Notification" (or run admin/cli/upgrade.php) for the changes to be reflected.

Depending on your Moodle configuration, changes to some assets such as CSS and Javascript night need a cache purge to be reflected (use /admin/purgecaches.php or /admin/cli/purge_caches.php)

Average of ratings: Useful (2)
In reply to Mark Johnson

Re: Developing a plugin for moodle ( moodle 3.6)

by hajar zankadi -
Thank you for your reply
in my case i am working under moodle 3.6
for the version.php file: the attribut: $plugin.version that i should bump ?
and for the $plugin.requires= 2018120300; ( right ?)
I am still new to moode development so any highlight or advice will be very useful for me
Thank you again for your help
In reply to hajar zankadi

Re: Developing a plugin for moodle ( moodle 3.6)

by Dominique Palumbo -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi,

To reword Mark.

The button clear the cache, is very helpfull : ) I use it each time I change language strings, add or change css or javascript. I also clear my browser cache often.

If you do some (creation, modification) amd javascript don't forget to change the parameter in your dev environment. (config.php)

$CFG->cachejs = false; // NOT FOR PRODUCTION SERVERS! 

I only change the version, in version.php when I change the DB (during development). When you do that you've a notification.

I transfert my file by FTP during development. (I only install stable version on production using the Moodle UI with zip. And before that update the local GIT)

So it's like

  1. copy file to Moodle dev by FTP
  2. Clear Moodle cache
  3. Clear browser cache
  4. Press CTRL- F5 on the web browser
  5. Validate Modifications
  6. Go to editor and code
  7. Go to 1. ...
Development work look so excited ; )

During development if I've to add/remove fields to db, I also prefere to restart from 0. To modify only the xml description of table and don't start to already create upgrade.

plugin.requires= 2018120300; (it's link to the minimum version of Moodle your plugin support)

Hope it's help.

Dominique.

Average of ratings: Useful (3)
In reply to Dominique Palumbo

Re: Developing a plugin for moodle ( moodle 3.6)

by hajar zankadi -
Thank you Dominique for you reply
I've learned now so many tips, thank you
I will try them out
Thank you again
In reply to Dominique Palumbo

Re: Developing a plugin for moodle ( moodle 3.6)

by hajar zankadi -
Hello Dominique
I have another question (That confuses me) could you please tell me what is the difference between this two: $plugin->version and $plugin->requires ?
also why when we make changes to db folder we must bump the version ( and here what we should bump the $plugin->version or the $plugin->requires ? )
last question, according to what you've highlighted, when we make changes to db we will get a notification, but in the other case ( no changes in db) how we will be notified that our plugin is recognized?
Thank you again and apologize me for this amount of questions
In reply to hajar zankadi

Re: Developing a plugin for moodle ( moodle 3.6)

by Dominique Palumbo -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hello hajar,


$plugin->requires
It's the minimum version of Moodle that your plugin requires to work.
you will find all the info you need on that page : https://docs.moodle.org/dev/Releases

for examples if your plugin require at minimum Moodle 3.3 you'll have that:

$plugin->requires = 2017051500;

$plugin->version is usually the version in date format of your plugin.
For example, if I release a new stable version of a plugin today I will wrote

$plugin->version = 2019061900;

If I do a change on DB, I'll also change this variable $plugin->release (but it's how I do it, I'm not sure it's what Moodle want)
ex:
$plugin->release = '0.0.1.1';

If you want to be sure and see a change in the Administration UI of Moodle (/admin/index.php) just change $plugin->version.
If you want to see change mlultiple times a day just increment the two last number
ex:
$plugin->version = 2019061901;


I hope it's clear.

You're all time welcome.

Dominique.
Average of ratings: Useful (2)
In reply to Dominique Palumbo

Re: Developing a plugin for moodle ( moodle 3.6)

by hajar zankadi -
Thank you so much
It's very clair
Kind regards