Answer the question
In order to leave comments, you need to log in
How to write a module for logging data of highload blocks?
The module must "remember" the changes that have occurred to the elements of highload blocks during the operation of the site, it must fix the number of added/changed/deleted elements. So that these changes can be transferred in the uploaded file to another site.
For example, in the interface, the administrator can upload changes according to the directory to a file (CSV or JSON) on the site where the module is installed and then on another site where this module is also available, export the changes.
What is the best way to organize changes storage, during OnBeforeUpdate/OnBeforeAdd events, dump data from a given highload block into a file, and then take the latest file in which the latest version of the highload block is imported? But what about deleted elements, they also need to be logged, do it by ID ?
The second question is, how is it better to check when exporting to another site?
I think it's easy to compare the ID and Code of the highload block; if such a highload block is not found on the site, then create it with all the data.
But what to do if the downloadable highload block is already on the site, what is the best way to proceed? Check if its elements have the same fields as in the dump file, if not, just make an exception and display a message, and if the data structure is the same, update and add elements (take ID and element name) and here I can’t figure out how to build an update because ID elements can differ, or update only those elements with the same ID?
Answer the question
In order to leave comments, you need to log in
Why is the existing migration solution not suitable for you?
marketplace.1c-bitrix.ru/solutions/sprint.migration Able
to transfer the structure and elements of highloads.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question