[BUG] Database Corruption

Ask for help or provide support to other members.
Post Reply
User avatar
NorfolkGreg
Posts: 190
Joined: Wed Sep 01, 2021 7:50 am

[BUG] Database Corruption

Post by NorfolkGreg »

Can other confirm that editing the name of a menu item on the settings causes corruption of database.js

I'm not absolutely sure what started it, but I believe it was doing that.

Once I'd edited a menu item name adding further items to the menu became highly unreliable. Pages would appear to be added but later visits to the Menu page of the modal would find them missing, although the content of the newly created pages would be accessible if I entered to correct URL in the browser address bar.

Eventually, I downloaded the database.js file to examine what was going on and discovered that there was a missing number in the list of menu items. while, as you might expect, further down the database file the content of the new pages, missing from the menu modal, were there.

I have managed to rectify the situation by manually editing the menu section of the database file to include menu items for all the page and sub-page content I had created after the issue was began.

My best guess is that there is something missing in the main code that does not allow for an edit to be made to a menu item name although the menu allows a user to make a change. Rather than accepting the name change the edit results in a menu item being removed as it no longer matches any item in the contents section of the database.

Can others confirm this?
TinyCoding
Posts: 17
Joined: Tue Aug 06, 2024 12:57 pm

Re: [BUG] Database Corruption

Post by TinyCoding »

I'll test again later, but so far; no.
User avatar
wiz
Posts: 822
Joined: Sat Oct 30, 2010 12:23 am

Re: [BUG] Database Corruption

Post by wiz »

Hi Greg, any chance you manage to reproduce this on a clean slate?

We do have some checks for database corruption in check (so the db doesn't end up being empty), but we extensively tested this and couldn't reproduce it successfully.
User avatar
NorfolkGreg
Posts: 190
Joined: Wed Sep 01, 2021 7:50 am

Re: [BUG] Database Corruption

Post by NorfolkGreg »

Thanks for the response, Wiz.

I'll try to find time to create a second copy of Wcms and populate it with a backup from before the corruption I reported and then take similar actions again to see if I can repeat the problem.

It may take me a couple of weeks. I've a busy period ahead.
User avatar
NorfolkGreg
Posts: 190
Joined: Wed Sep 01, 2021 7:50 am

Re: [BUG] Database Corruption

Post by NorfolkGreg »

Hi Robert,

A question to try to hunt down the bug, or what I might have done wrong.

I've dug out a backup and looked at the database.js file. Within the "Menuitems" section it contains this code:

Code: Select all

                    "3": {
                        "name": "Monaco",
                        "slug": "monaco",
                        "visibility": "hide",
                        "subpages": {}
                    },
                    "5": {
                        "name": "chromeos",
                        "slug": "chromeos",
                        "visibility": "hide",
                        "subpages": {}
                    },
After taking that backup (on 4 May) I didn't touch the site for a while. Then last week I was in the Menu editing section of the Admin Modal and renamed "chomeos". It was after that that I realised items began to go missing from the Menu page of the Admin screen but that the content of additional pages were stored in the database.

I presume that you would expect such behaviour given the missing menu item #4 and I now need to examine earlier backups to see what item "4" was and try to recall what it was I might have done to have the software delete that menu item.
User avatar
wiz
Posts: 822
Joined: Sat Oct 30, 2010 12:23 am

Re: [BUG] Database Corruption

Post by wiz »

Hi Greg.

I tried reproducing the same scenario, where I manually deleted the 4th page from the db file. And renamed the next one, it worked as expected.

I’m trying to think of how this came about.

I went a step further and tried messing it up even more, as such:

Code: Select all

            "0": {
                "name": "empty",
                "slug": "empty",
                "visibility": "show",
                "subpages": {}
            },
            "1": {
                "name": "First1",
                "slug": "first1",
                "visibility": "show",
                "subpages": {}
            },
            "3": {
                "name": "Third3",
                "slug": "third3",
                "visibility": "show",
                "subpages": {}
            },
            "5": {
                "name": "fifth12",
                "slug": "fifth12",
                "visibility": "show",
                "subpages": {}
            }
and renaming the pages worked just fine. Tried creating a new page, and it populated the missing order number.
User avatar
NorfolkGreg
Posts: 190
Joined: Wed Sep 01, 2021 7:50 am

Re: [BUG] Database Corruption

Post by NorfolkGreg »

Just realised I should have mentioned the missing #4 menu option was at the sub-page level which followed another top level item also with sub-pages.
Post Reply