No announcement yet.

Help! Board time screwup

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help! Board time screwup

    A couple days ago, I got it in my head to synchronize all my servers (I have 7 around the country) with each other time-wise. So I set one up as an NTP primary, and had the rest point to it. Easy-peesy, nice and easy.

    In doing this little project, I set the time manually first on my boxes via the date command, then synced the hardware clock to it. In doing this, I accidentally fat-fingered the date on the server my forums run on, putting in 2022 instead of 2002 for the year. Worse yet, I didn't even notice for a couple days. Neither did my members - they posted on, about 200 or so.

    After I saw the error I went back and corrected it on the server. Now here's the problem I have - there are a number of posts with 2022 as their datestamp. When people try to reply to them now, they either get errors or their replies go to the top of the thread, since they are seen as coming in 2002 when the rest of the thread is stamped 2022. Also some users are getting "Can't post more than once every 60 second" errors because I have flood control on and they posted, as far as the server knows, 20 years in the future <insert favorite time travel joke here>.

    Anyway, it's causing big problems. I figure, I can execute a mysql query, and perhaps do a search and replace on the date/year field substituting 2002 for 2022. Only thing is, while I am familiar enough with mysql, I'm still not sure of the exact syntax I should use and I have no idea where the time stamps are located - naturally, I don't want to replace the occurrence of 2022 anywhere in my vb db, only for the dates. Can someone please give me some pointers, quick?

    Thank you!!

    Maximum Gamer

  • #2
    Posted too soon, I was able to figure it out. Actually, it's not that hard to automate - I read other posts here that suggested one would have to change each dateline manually.

    In case anyone else has problems like this later, here's what you do:

    Log into mysql (I do it via command line, but phpmyadmin will work too). Go to the vbulletin dateabase, issue the commands below. From the command prompt it will look like this:

    #mysql -u username -p password
    mysql> use vbulletin
    mysql> update post set dateline = replace(dateline,'xxxx,'zzzz');
    mysql> update thread set dateline = replace(dateline,'xxxx,'zzzz');
    mysql> update post set lastpost = replace(lastpost,'xxxx','zzzz');
    That will do a search and replace on the dateline field for the "post" table as well as the same for the thread table, fields dateline and lastpost. Now, the only tricky part left is, the times are in unix timestamp format. You need to figure out two things - the incorrect date (shown as "xxxx" above) and the date you want to correct it to (shown as "yyyy" above). You won't want to change the whole string, just the part of the date that is off. In my case, it was the year, which was expressed as 16725 for 2022. 2002 is 10414. So that's what I did a search and replace on. YMMV. Here's a link to a website that will do the format conversion for ya:

    Hope this helps others out.

    Maximum Gamer


    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.