We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Sync All Templates?

How Do I?

aspenmusicfestival's avatar
aspenmusicfestival
3 posts
8 years ago
aspenmusicfestival's avatar aspenmusicfestival

Unless I am missing something, the template syncing behavior leaves a big gap in how developers would typically want to work with templates on a production website.

Local dev environment: * Save templates as files = yes. * Edit template files in my IDE. * Check templates into source control (github repo).

Production environment: * Save templates as files = NO. * Pull down latest from github. * ??? There’s no way to tell EE (3.4.6) to sync all templates (is there?).

I found an add-on that turns things upside-down, that will actually remove templates from the database if the file goes away, but that still only works at runtime and depends on the “save as files” feature to be turned on.

Please advise - I would like to sync all in one go. Thanks.

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
8 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

Why would Production have Save template as files set to no?

       
aspenmusicfestival's avatar
aspenmusicfestival
3 posts
8 years ago
aspenmusicfestival's avatar aspenmusicfestival

As I understand it, the template system does a check when it loads pages to see if the template file’s save date differs from the date marked in the database, and then copies the file to the database if it does differ. To make this check every page load seems quite inefficient to me. Is that an incorrect impression of what’s going on? In the case of dynamic pages where I cannot have the entire template cached, but only parts of it, this seems especially problematic, since it would have to happen every page load, not just once before the template is cached.

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
8 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

You’re correct. But in 99.999999995% of cases that check should have no performance hit. I have a site that gets over a million views each month and it’s never been an issue.

Another option is to upload and then turn Save Templates as Files on and then off. I believe in 3.x when you turn it on, it syncs. Give it a shot?

       
aspenmusicfestival's avatar
aspenmusicfestival
3 posts
8 years ago
aspenmusicfestival's avatar aspenmusicfestival

Thanks, that’s good to know. I would like to know for sure if the CMS will sync all templates when turned on / off. I will look for documentation - if you happen to know where to look please let me know.

       
Derek Jones's avatar
Derek Jones
7,561 posts
8 years ago
Derek Jones's avatar Derek Jones

Yes, if you enable saving as a files, upload/deploy all of the latest templates files, and then hit the Template Manager, your templates from the file system will sync to the database.

I’d echo Pedro though, there’s no performance reason to disable this on production, I think that’s a bit of FUD that is leftover from the days of PHP 4. You can always check if you have a measurable difference in performance after enabling (check a before and after with Debugging enabled). If you notice a difference, come back here and we can troubleshoot—it would likely mean a bigger environmental issue that if addressed would have a major impact on server resource usage.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.