What are all these "MetaDataCraete" / "MetaDataDelete" entries coming from?

In most of the custom plugin I have made I get lots of these entries, what is causing this... Most of them were based on the structure of Blog Plugin, but blog does not create and delete a bunch of metadata like my customs do.  Are these entries from "get_entities_from_metadata"?

 

 

  • What do you mean by 'entries' are these entities showing up on the site? Or records showing up in the log?

    It's nothing from elgg_get_entities_from_metadata

  • in the log. 

    Date and time IP address User User GUID Object type Object GUID Action
    Sat, 28 Mar 2015 06:18:36 +0100 127.0.0.1 TestUser 79 ElggMetadata 41542 Create
    Sat, 28 Mar 2015 06:18:36 +0100 127.0.0.1 TestUser 79 ElggMetadata 41532 Delete
  • every view loads at least 12 of these... cerate/delete/create/delete. and so on...

  • That's the system log, it records any time something happens within the entity model of elgg, in this case when metadata gets created or deleted.  So when your page loads the user writes new metadata on the entity.

  • Yes, I understand what the log does, but I do not understand what metadata is being written and why it is being written on the users behalf when a page loads, I am sort of aimless taking a look at how I deal with entity icons, as a best guess of metadata that would get created and destroyed on page load in relation to an entity, but I don't think my answer is there.

  • So is it normal that a user is writing metadata on page loads?

  • Hook into create/delete/update, metadata events and log the metadata to see what exactly is being written. Perhaps some oversight somewhere. Or maybe something is updating view counts, IP etc.

  • It sounds weird that a plugin would write metadata on every page load unless the user is creating or editing content. I recommend figuring out what exactly is happening.

    Find out which plugin it is by using the normal routine: disable all non-bundled plugins, start enabling them one by one, and test after each one whether the metadata is being written or not.

  • It may or may not be normal, depending on the use case.

  • Ah ha......   

    I added an enable/disable metadata value late in development, so in entity summary i wrote:

    if(!$entity->enable || $entity->enable != 'disable'){
        $entity->enable = 'enable';
    }

    to correct it where that data had not been written to the original entity...  and as I look now i am also missing a NULL case, so it fires more than it needs to.....PHEW....

    and that writes the metadata on behalf of the current user.

    corrected with:

    if(empty($entity->enable) || $entity->enable != 'disable'){
        $entity->enable = 'enable';
    }

    and now I suppose I could trigger a write to the log telling me that an entity was corrected.  But even better I suppose I could write this into a hook in my theme.

    Thanks, knowing those writes were not normal was the key.