OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

CommonPart.PublishedUtc is not preserved on import #6818

Open jersiovic opened 8 years ago

jersiovic commented 8 years ago

When a team is working on the same project, each developer has its own localdb. This localdb is created each time the developer starts with a new feature/branch using a setup recipe that is feed by all the team. When the developer ends with its feature for the site, he exports a recipe of the complete site for replacing the original one. So, in merge process of the branch he resolves conflicts in recipe reviewing differences with dev branch.

Problem is PublishedUtc field that is exported in a recipe is ignored when you import that recipe. Indeed the PublishedUtc value assigned to the contentItem is the date at the moment of the import. This causes that on every merge you find differences for PublishedUtc on each content item in the recipe. So, to avoid every developer has a different PublishedUtc date on its recipe when he creates the site it would be needed recipes won't contain PublishedUtc or that the PublishedUtc of the recipe is used for the content after export instead of current one.

By the moment we have commented PublishedUtc on the CommonPartDriver.Export() method but I'm not sure this is a good solution. The reason is when you export a complete site in production to replicate it locally you want data are the same to be able of replicating same behaviour. So, if logic you have implemented relies on publishing dates, the behaviour of your local site won't be what you expected to be.

So, a better solution would be that PublishedUtc date is used in import.

DaRosenberg commented 8 years ago

We had raised this same issue a while back, don't remember the details but the conclusion was that this could not easily be changed. In our free open-source IDeliverable.Bits module we provide a recipe step that automatically removes the PublishedUtc attribute from the export, making source control compare/merge easier - feel free to try that.

jersiovic commented 8 years ago

Thank you for the info.

I will make another attempt when I have time because it is the ice on the cake for recipes. Problem only happens with new items?, I mean, Is the PublishUtc date set ok when you use a recipe to update an existing items that was published before the import operation? If the answer is yes maybe there is space for a hack.

I will try ...