Documentation for events / listeners

  • Hi all,


    I'm currently running i-MSCP 1.2.0 and was about to start upgrading to the latest release, however I have some customisations in various .conf files which will be wiped out by the installer.


    Since this is a problem every time I upgrade, I thought I would write some listener files to deal with the modifications (I believe that's the correct way?), however I'm unable to find a list of the events which the listeners have available to them, or any documentation on how listeners work.


    The only information I've been able to find are the listeners which others have made on the forum here, i-MSCP listener files ( previously known as hook files ) and a brief document here https://github.com/i-MSCP/imsc…onfigs/debian/listeners.d


    In the brief sample listener on github, I can see that the sample listener is listening for the "beforeInstall" event, and in the "add a sender canonical map to postfix" listener here https://github.com/i-MSCP/hook…stfix_sender_canoncial.pl I can see that the event is "afterMtaBuildMainCfFile"


    I can't seem to locate a list of the events however, so I can't write my listeners because I don't know what other events are available or when they trigger.


    For my postfix .conf files, I can use the provided listeners and modify to my needs, but I would prefer to properly understand how to create listener files from scratch so that I can be sure that I know what I'm doing and what effect it will have on my instance of i-MSCP. All testing is being done on a virtual machine so I'm not worried about breaking anything, but I need a starting point to begin experimenting.


    I've tried searching for "hooks", "listeners" and "events" on the forum, the Wiki and even the web in general, but I can't find any more information. Could somebody point me in the correct direction please?


    Thanks!
    :)

  • Thanks, that helps :-)


    One of the .conf files I need to write a listener for is the proftpd.conf - where in the i-MSCP code would I look to find the appropriate events to listen for? Is there a common pattern to the event names so I can grep for them in the source?


    Thanks :-)

  • @Number 6


    As stated by @Ninos, there is not documentation ATM. We will provide documentation for version 2.0.0.
    Right now, you can at least find list of events which are triggered using the following commands:

    Shell-Script
    1. # grep -nr 'trigger(' /var/www/imscp/engine# grep -nr 'dispatch(' /var/www/imscp/gui

    Then, once you have the event names you can always look at the related code part.


    For instance:


    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • For proftpd:


    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206