• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Reverting templates seems... unreliable

wwwicked

Active member
#1
I've just updated to 1.0.4 so I'm working through the outdated templates.

My method is to copy the current template into one pane of WinMerge, revert, copy the reverted template into the other pane of WinMerge, diff them and work through the differences to work out which changes I need to reapply.

However, many of the templates I try to revert don't seem to revert at all. I get a dialogue box asking my if I want to revert the template, and I click "Revert Template". The button greys out, but after a few seconds it becomes active again. I've checked that it's still asking about the same style, and it is. Eventually, I end up on a "/delete" page (e.g. admin.php?templates/message_user_info.632/delete), with no page content.

I've checked the apache error log, and see:

[Tue Jul 19 21:25:04 2011] [error] [client 90.211.77.47] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /home/sites/respawned.co.uk/www/xf/library/Zend/Db/Adapter/Abstract.php on line 1046, referer: http://www.respawned.co.uk/forums/admin.php?templates/message_user_info.632/edit

Or, alternatively:

[Tue Jul 19 21:28:09 2011] [error] [client 90.211.77.47] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /home/sites/respawned.co.uk/www/xf/library/XenForo/Template/Compiler.php on line 419, referer: http://www.respawned.co.uk/forums/admin.php?templates/quick_reply.635/edit

Should reverting a template take so long?
 

RobParker

Well-known member
#4
It's been suggested but for now it's only possible from a mysql query. Brogan will know it off the top of his head so I'll leave it to him ;-)
 

wwwicked

Active member
#5
The following works for getting a count of users:
Code:
SELECT s.style_id, s.title, COUNT(u.style_id) AS num FROM xf_style AS s
LEFT JOIN xf_user AS u ON s.style_id = u.style_id 
GROUP BY s.style_id 
ORDER BY num DESC;
Seems someone uses almost every style. I might remove Red Fixed Width if it helps make the reverting work, as no one uses that and it has 21 modified templates.
 

Brogan

XenForo moderator
Staff member
#6
You've got 7 styles there so that's a lot of templates which need to be rebuilt each time.
You can try changing the php timeout values, that should help.

Edit: I see you've worked out how to check which styles are being used.
 

wwwicked

Active member
#7
Well, deleting "Red Fixed Width" & "Rico Test Style 1" seems to have been enough to make the reverting work OK. I didn't really think 6 or 7 templates was a lot, but I guess it depends on the horsepower of the CPU it's running on.
 

Jake Bunce

XenForo moderator
Staff member
#8
Well, deleting "Red Fixed Width" & "Rico Test Style 1" seems to have been enough to make the reverting work OK. I didn't really think 6 or 7 templates was a lot, but I guess it depends on the horsepower of the CPU it's running on.
The template system in XenForo trades extra processing at save time for optimal performance at run time. This can result in timeouts at save time if you have a lot of styles installed but the performance gains are worth it, especially for high traffic forums.

Kier says they hope to optimize the save time eventually:

http://xenforo.com/community/threads/external-cause-cannot-delete-template.13952/#post-183018
 

Vilandra

Active member
#9
Just in case it makes a difference, I'm having the same problem on my test board run locally on my laptop (using xampp) and with only 2 styles. (Though I don't get any errors, but reverting the template just hangs and nothing is reverted.)