About versioning and restoring content

  Written by The Jahia Team
   Estimated reading time:
7.0 7.1 7.2 7.3

Jahia CMS includes with a versioning system based on the JCR API. The versioning system has two different behavior, one for files (binaries) and another one slightly different for other content types.

On files every time you upload a file with the same name, Jahia offers the possibility to create a new version of this file so you can always restore an older version or access it. For content there is no version in the default workspace, versions are only created when publishing this content.

When you publish a batch of content or files, Jahia increments the version of the impacted elements (mainly all the modified contents that are part of this batch of publication).

To see how it works, import the prepackaged demo site in Jahia and publish everything.

  1. Now select the rich text under "How to use this demonstration ?", edit it go to the versioning tab, you will see only one entry displaying your date of publication.
  2. Now go to the content tab and modify the rich text by adding some content or changing the existing one, then save.
  3. To see that some content has been modified on this page we can refresh the left tree displaying the pages tree with there publication status, our home page should appear with a red dot next to it. You can also display the publication status from the publication menu in the toolbar, this will highlight the zone where some content has been modified.
  4. Edit once again this rich text and go to the versioning panel, we still have only one version as this content is not published yet, click on the "Compare with staging version" to compare you two version.
  5. You can also select the content in the page and then use the compare menu entries from View menu in the toolbar. You can compare at the page level for example (select the page and click on "Compare staging vs live version" in the View menu.
  6. Publish your modification. In the Versioning panel on your rich text you should see two version now. Compare the oldest version with the staging and restore it by clicking on the "Restore" button on the top left corner of the opened window, when you close everything your rich text is back to its original value, if you publish it again that will create a new version.

The restore function is only available on a content level, you can not restore a whole page directly to a certain state. Pages are much more complexed objects than what meets the eyes (If we restore a page what do we do of its child pages, do we restore also the templates, etc.)

You can display any version of an URL by passing a date (in a long format) as a parameter http://localhost:8080/jahia/cms/render/default/en/sites/ACME/home.html?v=1305815700000 Jahia 6.6 will retrieve the state of the content at this date and all displayed content we will be displayed at this date (files, etc.) the only exception is the queries that will return results from the present and not from the past, indexes have no version.

When you restore a file this will automatically create a new version, like you have uploaded a new version. This is not the case for the content, the only versioning on content is on publication.