We had a little outage over at LET.
And I’m to blame.
It was all to change a single character in the site’s footer. Previously it said “2008-2021” for copyright and I thought it was time to update it.
Vanilla Templates
LowEndTalk runs on Vanilla Forum and it uses Smarty templates. This is a very common templating engine. WHMCS also uses it.
If it was a .php file, I’d probably change the line to something like
2008-<?php echo date("Y"); ?>
But Smarty doesn’t run through PHP. I had a notion to put in a little JavaScript function that would update a div tag, and I started screwing around with it.
The relevant file is themes/$THEMENAME/views/default.master.tpl. When I went to change it, I thought “I should save a ‘before’ copy so I can back out easily”. So I saved default.master.tpl.prev.
And then all hell broke loose.
Vanilla’s cache became greatly confused by the existence of master.tpl.prev and basically threw up all over its shoelaces. The site started spitting out the raw template code instead of processing the template.
I immediately assumed it was something bad in the .tpl, so naturally I copied (not moved) the .prev file into place. No luck. I grabbed the master.tpl file from last night’s backup and restored it. Still no luck. At that point, everything was back exactly as it was, even the same timestamp on the file, but the desktop view was still broken.
I did a find for all files in the public_html that had changed and saw the Smarty cache compile dir had some recently-changed files. I removed the master.tpl-related files thinking Smarty was just not updating them, but it recreated them as still broken.
@FAT32 logged in and diagnosed that the existence of the .prev file was the problem. Once it was removed, the problem vanished.
So let this be a lesson: if you’re going to make changes in production, don’t try and be responsible by saving a rollback file. Throw caution to the wind or else it could come back to bite you.
No, Actually the Lessons Are…
OK, OK, don’t do things in production without testing them in a dev environment.
And turns out there is a Smarty way to solve this problem:
{$smarty.now|date_format:"%Y"}
I’ll, um, test that first before putting into prod.
Related Posts:
- Early Black Friday Offer: VersaWeb has a Dedi Deal in Las Vegas, Dallas, and Miami! - November 23, 2024
- LowEndBoxTV: Are All Hetzner Locations Alike?No!And Piotr Has the Proof: “This is Clearly Not the Same Processor” - November 22, 2024
- One Week From Tomorrow…THE WORLD WILL LOSE THEIR MINDS!Lines Are Already Forming! - November 21, 2024
It’s a cautionary tale reminding us of the unexpected consequences of even seemingly minor changes in a production environment. Backups are important, but sometimes even they can cause unexpected issues.
Thanks for sharing.