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

Reverting templates seems... unreliable

Discussion in 'Installation, Upgrade, and Import Support' started by wwwicked, Jul 19, 2011.

  1. wwwicked

    wwwicked Active Member

    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] 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] 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?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    How many styles do you have installed?
  3. wwwicked

    wwwicked Active Member

  4. RobParker

    RobParker Well-Known Member

    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 ;-)
  5. wwwicked

    wwwicked Active Member

    The following works for getting a count of users:
    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.
  6. Brogan

    Brogan XenForo Moderator Staff Member

    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.
  7. wwwicked

    wwwicked Active Member

    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.
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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:

  9. Vilandra

    Vilandra Active Member

    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.)

Share This Page