LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

The Story of How I Broke LowEndTalk This Week

We had a little outage over at LET.

And I’m to blame.LET Footer

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.

Mickey SorcererAnd 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.

raindog308

2 Comments

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

    April 11, 2024 @ 9:13 pm | Reply
  2. Thanks for sharing.

    September 24, 2024 @ 6:38 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *