Metadata.php is great, but

Now that I’m migrating to Oxid version 4.7.7 it’s great to see how much modules have improved. The metadata.php file is great for describing all module functionality in a single place, in a way that can be versioned in Git. There is a catch however: the data from metadata.php is not used directly but instead is copied to the database (oxconfig and oxtplblocks). I don’t see any advantage in doing this, but it does cause me all kinds of problems, that stem from synchronisation problems between the database tables and the metadata file.
Whenever I change the metadata file I have to deactivate and reactivate the module so it refreshes the data in oxconfig.
If I change the blocks in metadata there is no mechanism that would synchronise the changes to oxtplblocks - not even de- and reactivating the module will do that. Oxid merely updates the active column for any modules already in the table but doesn’t add, remove or update any new or existing block row. The only solution is to delete all rows for that module in the oxtplblock table then de- and reactivate the module.
Besides from making module development a pain this also causes me problems with deployment. When I deploy a changed version of the shop I want all my changes to be versioned and deployed from version control. Currently updating the modules on the server doesn’t do the trick as I have to go and manually update the oxconfig and oxtplblocks tables to reflect the state I want.

Solution proposal: if there was no state in the database then we of course couldn’t switch off modules on the fly. I think this could be solved by storing only a list of disabled modules in the database, so an admin could switch modules off but the deployment would still update all module data otherwise.

Hi Sandor,

good news: @l3k was working on this bug(s) recently. The following bugs are concerned:
https://bugs.oxid-esales.com/view.php?id=4025 and
https://bugs.oxid-esales.com/view.php?id=4129

You’ll find all changes related to this bugs in the appropriate commits (starting with the bug number):

Actually, for performance reasons, it is the most practical solution to store this information in the database to prevent from permanently scanning the files etc…

Regards

Thanks for the explanation Marco!

As for the file vs database performace comment I can’t see how loading a file is slower then making a database query which is potentially (mostly) done through the network. The config.inc.php is scanned continuously for example. Considering how much such synchronisation complicates the module handling logic I don’t think it’s a good tradeoff anyway.