Is there anyway to restore templates via their history?

RichardKYA

Well-known member
I accidentally uninstalled what was going to be my final version of an add on I have been developing. I went to export but for some reason uninstalled it.

I had exported a copy a few days ago, but I can't find it for love nor money and the closest copy I can find is from January 29th, which means I pretty much deleted a months worth of work.

I thought all was lost until I saw the "View history" button and when I clicked on it, I had a version from Wednesday which was the last time that I edited this certain template. I am now starting to go through and use this as a way to get back what I would have otherwise lost.

Between January 29th and now, I had created multiple new templates that obviously do not get created when using my backup, but, after finding out that the history remained intact for the rest of my templates even though the add on was completely uninstalled, I am hoping that the history for my newer templates exists somewhere and I am hoping that I can somehow use that to recreate them properly?

Does anyone know if this is possible?

Thank you
 
Last edited:

Nudaii

Well-known member
I'm not sure to the question, however do you have backups of the site database?

I personally backup my dev sites both locally and to aws daily
 

RichardKYA

Well-known member
Stupidly, I rarely backup my dev db. I know it's dumb. I do however export my add on as a backup frequently, but when it came to looking for my backups, the closest one I could find was from 4weeks ago o_O

I honestly don't where the others have gone, I used a more recent one a few days back because I added a new table to the db and wanted to make sure it installed OK, so I exported my add on and used the xml to upgrade, so I'm scratching my head wondering where that copy has gone. The only thing I can think of is that my niece used my mac on Saturday to download some music and all downloads go to one folder, so she may have deleted my files along with her stuff by mistake. Other than that, I have no idea.

My question is about the history of templates. Because I uninstalled my add on, I would have thought that the template history would have been deleted, but it hasn't been, so if the history is intact somewhere, then maybe I can use that to recreate other templates that are not a part of the xml backup that I am using.

So if I have 5 templates....

created before jan 29th
temp_1
temp_2
temp_3

created after jan 29th
temp_4
temp_5

When I uninstalled the add on, all of them get deleted. When I use the Jan 29th xml backup, only the first 3 templates are created, but the other 2 are not.

Now, the interesting bit is, that when I view the history of those 3 templates, the history still shows versions that were edited after Jan 29th, which means, that information is saved somewhere even though the add on was completely uninstalled.

So what I am hoping is, I can somehow access the history for the other 2 templates that were created after my Jan 29th backup and use that to recreate them.

Does that make more sense?
 

RichardKYA

Well-known member
OK, figured this out. Pretty simple really, just create a new template with the same name as before and the history will show up.

I just recovered about 90% of my work.

Thank you XF dev team for storing template history.
 
Top