User problem after a database restore

Bug Reports
  • Over the weekend we had 300 or so bots register on the forum. I deleted them yesterday. After that, i tried to do an update to the latest RC as i wanted to use the latest features on the spam plugin. The update caused some redirect loops and NodeBB would not work.

    I restored to a back up i created just be fore the update but then i found out that some of the threads had posts missing and in the incorrect order.

    I restored the database, the version of the database had the 300 or so bots on it that I had previously delete.

    Clicking on the users menu it showed all the normal user and all the bots which it should do as that was the database that i used. The forum stats widget only showed 40.
    Clicking on a bot that I had deleted before the restore would produce a 404 page.
    In the admin cp I could delete the bot users with no issue.

    I removed all the bots but now the forum stats widget is showing -228 users.

    Is there any way i can reset the stats to be the correct number?

  • Isn't going back to a backup restoring the forum stats?

  • No, it kept it at 40 and then when i deleted the bot users it changed to a -228.

  • That's weird the backup should restore everything including those stats.

    In anycase you can set the correct value by

    zcard users:joindate
    hset global userCount <value from zcard command>
  • @baris im using mongo 😉

  • In that case it would be something like

    db.objects.count({"_key": "users:joindate"});
    db.objects.update({"_key": "global"}, {$set: {"userCount":<value from above command>}}, {upsert:true, w:1});
  • @baris Cheers man, worked like a charm! ❤

Suggested Topics