Jump to content

Orphaned data generated for some fields types, stays in DB


Soma
 Share

Recommended Posts

I noticed soemthing strange I don't think is very good.

Add a date or email field to a template (ie basic-page). After filling the field on one page and looking at DB field table everything is ok, there's a new entry, the value is saved with the page id.

Now if you remove the field from the template, you get prompted if you really want to, and after hitting ok, it shows messages for each page that uses this template that the field was deleted. So far so good.

Now but you wouldn't expect that if you look at the field table, suddenly there's an empty entry for one and each page that has this template! Oops. And this empty data will stay there until you delete the field itself.

It happens so far for date and the email field, for text field it seems ok.

I use 2.3 dev (not nightly) and haven't tested in older versions.

  • Like 2
Link to comment
Share on other sites

Thanks Soma, I confirmed the issue, at least in 2.3.1 and fixed it yesterday. I'm not exactly sure when it was introduced, but it's possible it's been there for a couple of major versions. The entries were getting deleted as they should, but then inserted again when the $page->save(); occurred within the same function. The thing that I'm not yet sure about is why i had a $page->save(); in there, which doesn't seem necessary. But there must have been a reason for it, which escapes me so far. So I've left it there commented out to examine further. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...