We've been having some issues with setup scripts causing an issue when updating CMS blocks, throws an exception and fails the deployment.
The issue was related to using the Mage::getModel('cms/block')->load()
function which actually does an is_active
filter in the background.
Meaning if you try and update a cms block that the client has actually marked as in_active, you're code assumes it is creating a new one instead of updating.
To get around this you HAVE to use collections.
The script below was an example for a particular project, in which each store had its own CMS block with the same identifier. The key ingredient is how the CMS block is updated within the second loop.