CONF-13798, we store the build number in the database and prevent Confluence from starting up when the home directory and database build numbers don't match.
When a site restore is performed, the build number in the database is replaced with the value from the backup. When the backup is from a different version, this will prevent the next application startup with the error message:
Starting from version 5.1.5, the history of Confluence upgrades will no longer be included in a site backup. This means that backups created from 5.1.5 or later should no longer encounter this issue.
Restoring a backup that was created prior to 5.1.5 into any version of Confluence that is newer than 5.1.2 will still trigger this error, and the following workaround should be followed.
Workaround is to clear the build number from the database - it will be repopulated from the home directory at startup:
1. Shutdown Confluence
2. Backup your Confluence database!
3. Run the following SQL query on the database: