Block Install notification

Block Install notification

by Mark Williamson -
Number of replies: 2

Hi,

Is there a method that gets called during a block install or update.

I know the init() method can get called when ever a block is being used / accessed, however I would like to do something only one time during install process or update process and not have to put code in an init() method which could be called multiple times, resulting in having to do checks to see if my operation has been done yet or not.

Best,

Mark

Average of ratings: -
In reply to Mark Williamson

Re: Block Install notification

by Jason Hardin -

If you are working in Moodle 2 then you have access to db/install.php and db/upgrade.php  see http://docs.moodle.org/dev/Installing_and_upgrading_plugin_database_tables#install.php.

To verify tough you are talking about the install and upgrade processes and not adding a block to a course correct?

 

In reply to Jason Hardin

Re: Block Install notification

by Mark Williamson -

Yes that is correct, just want to run some code upon a plugin install or a plugin upgrade only.