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

Fetch public templates as files

Discussion in 'Troubleshooting and Problems' started by lamvunhat, Dec 28, 2012.

  1. lamvunhat

    lamvunhat Member

    "Fetch public templates as files" is good way to make better performance. I am using 6 web servers (load balancing). But i don't know about how to make "Fetch public templates as files". Can you help me?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Templates as files will only be a performance benefit if you have an opcode cache installed in PHP such as APC. The templates will be stored in internal_data/templates if you enable that option.
  3. lamvunhat

    lamvunhat Member

    Yes, I have an opcode cache installed (eAccelerator). But the problem is: If I edit the template, how do all the server can rebuid the template compiled (stored in internal_data/templates)
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Oh. With multiple front end servers that will be a problem. You would have to setup file replication between the servers.
  5. HWS

    HWS Well-Known Member

    If you use a web server cluster for your web site you have to do that anyway. There are several directories (avatars, attachments, etc) that need to be synchronized...

    So, either you don't have 6 web servers currently serving your single XenForo site or there is another problem with your question...
  6. Jeremy P

    Jeremy P Well-Known Member

    Not really. If your site requires 6 web servers you're probably using a CDN. You can serve avatars and attachments from a CDN (with origin pull). Even for full attachments, at least with an addon. That's not an option for templates because they're not static.

    In which case, Jake's answer is correct and your post contributes nothing to the conversation other than the usual skepticism.
  7. lamvunhat

    lamvunhat Member

    Disable attachment by Xenforo and develop add-on as Image manager. I have a server images storage (Avatar, Image upload by member) via cURL. Only file image is allowed to upload on my system. But "Fetch public templates as files" is other issues :oops:
  8. Aivaras

    Aivaras Active Member

    Does one have to add anything to "config.php" after enabling "Fetch public templates as files"?

    Can the folder "templates" and its contents be safely deleted after disabling "Fetch public templates as files"?
  9. Chris D

    Chris D XenForo Developer Staff Member

    No, just the fact that they are on the file system as PHP files is enough for your opcode cache (if you have one) to handle them.

    Incidentally, in XF2, there is no option and the templates are just stored there by default.

    Yes, you can delete the internal_data/templates directory in XF1 if you are no longer using that option. The files should be deleted automatically, though.
    Jake Bunce and Aivaras like this.
  10. Aivaras

    Aivaras Active Member

    Thank you very much, Chris.

Share This Page