I
I
Ivan Fotiev2017-10-02 13:12:45
1C-Bitrix
Ivan Fotiev, 2017-10-02 13:12:45

How to create an agent in your module?

Hello. I am developing a module and I need to create an agent during module installation. To create an agent, I use CAgent::AddAgent() to this method, you need to pass a class and a function that the agent will run. Where should they be placed in the module structure?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Nikolaev, 2017-10-03
@ifotev

And what is the actual question? Do as according to the documentation
1) When installing the module, add the agent:
where
"\\Your\\Module\\SuperClass::superAgent();" - php code to be executed (semicolon at the end strictly!!!)
"your.module" - name of your module
"N" - frequency
10 * 24 * 3600 = start frequency
'' - first check date (leave empty)
" Y" - agent activity
2) When deleting - we clear the agents 3) If the files are located according to the d7 canons ( /your.module/lib/superclass.php ), then nothing else needs to be done, if the old one, then you need to register it in include.php autoloader for your class with an agent

A
Alexander Filippenko, 2017-10-02
@alexfilus

It doesn't really matter. Check only that the agent function is available when the module is connected.

A
Alexey Emelyanov, 2017-10-02
@babarun

Where should they be placed in the module structure?

At least in include.php.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question