Sitecore Upgrade Post Step Scripts
Charlie Turano recently told me a lesser known fact about Sitecore’s upgrade process. There is a block of code that gets executed to update existing items in the database. This is what’s known as an installation ‘Post Step’, and it gets triggered after the new or changed items are added to the database.
For example, Sitecore 6.5 updated the ‘Placeholder Settings’ items to have a new ‘Placeholder Key’ field.
Placeholders originally went off the Placeholder Setting item’s relative path and name, but in 6.5 they moved towards using the new ‘Placeholder Key’ field instead.
To keep existing Placeholder Settings items working after an upgrade from 6.4 to 6.5, the Post Step script would need to figure out the relative paths and item names of all existing placeholder Settings items, and put it into this new ‘Placeholder Key’ field.
So how does Sitecore know what code to execute for the upgrade?
Well, it turns out the Sitecore .update package is just a zip. Change the extension, and you can crack it open like any other zip file.
Inside there you will find a ‘metadata’ folder, with a file called ‘sc_poststep.txt’. The file will contain a fully qualified namespace, class and assembly.
(Note: Since 6.6.0 Update-2 (rev. 121203), the value has always been Sitecore.Shell.Upgrades.PostStep,Sitecore.Client….but the code that is run internally has changed.)
Open that up in some disassembler (I use ILSpy), and you can see the code that will be executed.
Thanks to Charlie Turano for letting me know about this part of the Sitecore upgrade process.
Thanks. Very helpful. I am using this mechanism to ensure Condition and Action items are created when a DLL is installed.