0
votes

I'd like a module to install some content, for instance add some static blocks to the CMS section when the module is installed (I know how to do this).

It'd only be PHP and Magento stuff, there's no direct need for SQL, no database table, nothing like that.

So a generic PHP script that configures Magento the right way, but only during installs or upgrades of that particular module.

I know I could use the Setup Resource mysql4-install-#.#.#.php script method for this, but that just feels plain wrong.

Any ideas?

2

2 Answers

3
votes

This is an appropriate usage - you are working with the database if you are adding or updating CMS. In fact, it's how the initial homepage fixture data is implemented.

Note that in CE >= 1.6 and EE >= 1.11 there is a complete DDL which should be used: ALTER TABLE in Magento setup script without using SQL

1
votes

Thats not wrong at all. The setup resource is there to perform one-time-only actions. I personally think that that is a perfect use of the Install resource. You don't have to use it to do direct DB queries. You can also use it to make indirect DB queries (which is what you're doing when you add new content to the CMS)