I updated to metatag beta9, some days ago. Today i wanted to change a metatag and saw...well ALL METATAGS ARE DELETED IN EVERY NODE.
What the hell. This is seriously dangerous. So i suggested some warning. This may happen to you too.

Update note:

Removed 2 meta tag record(s) for the taxonomy_vocabulary entity type, it does not support meta tags.
Removed 1 meta tag record(s) for the rules_config entity type, it does not support meta tags.
Removed 5 meta tag record(s) for nodes that had been purged.
Removed 26 meta tag record(s) for taxonomy terms that had been purged.

Jea it removed 5 metatag records from my five nodes. These nodes have not been purged but somehow the update thought so.

Comments

marcoka’s picture

Ok. I cleared the cache.
This is the Metatag field inside the node is empty.

But inside the code i get

<meta name="abstract" content="my metatags here." />
<meta about="/kaufberatung" property="sioc:num_replies" content="0" datatype="xsd:integer" />
<meta content="Kaufberatung" about="/kaufberatung" property="dc:title" />
<meta name="description" content="content="my meta tgas here" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="MobileOptimized" content="width" />
<meta name="HandheldFriendly" content="true" />
<meta name="apple-mobile-web-app-capable" content="yes" />

so somehow the meta tags get still generated correctly but not displayed in the field. default is not used, its the text i typed in manually.
edit: its seems that this happened only on some nodes. no real pattern detectable. all nodes are of the same type.

marcoka’s picture

Issue summary: View changes

i am open for debug suggestions. i have phpstorm and xdebug running.

marcoka’s picture

i checked my database
http://i.imgur.com/6bdmBhN.png

the data is still here but somehow default settings are used in every single node
http://i.imgur.com/EWSWXZ0.png

edit, checked the BLOB, converted it: http://i.imgur.com/4k40Sd6.png
so data is still there but not loaded in the node.

version i used before update: 7.x-1.0-beta4

damienmckenna’s picture

damienmckenna’s picture

Title: Update kills all metatags » Metatag data not loading
Version: 7.x-1.0-beta9 » 7.x-1.x-dev
Category: Task » Bug report
Priority: Critical » Normal

There are several pieces to this puzzle.

First off, the "Removed @count meta tag record(s) for nodes that had been purged" part only happens if there are nodes that had been deleted and had left {metatag} records behind, it won't (or at least *should* not, and I've tested it quite a bit) delete {metatag} records if the node exists.

Secondly, it seems like there may be something causing the node meta tags to not load correctly. Can you please show me a full dump of the {metatag} records for one of the nodes, and then compare the 'language', and 'vid' values in the {node} table and let me know if they match? Also, what is your site's default language?

I've reduced the priority of this to 'normal' and updated some other options to be more accurate against the remaining problem.

lnicks’s picture

I am having the same issue with beta9.

We attempted to migrate from nodewords on d6 to metatag on d7, using the nodewords_migrate module located here: https://drupal.org/node/1434756#comment-7863375

However this threw errors, so following the instructions here:
https://drupal.org/comment/6914602#comment-6914602
we were able to finish the migration.

The records imported the meta data correctly, but revision_id and language columns were empty. Manually assigning the records the matching vid from the {node} table and setting the language to en causes the data to appear in the edit form.

My guess is that the migration didn't move that data over and that is a separate issue, which I'm guessing is related to the columns just not existing in that version of metatag? I just wanted to write and confirm that changing the revision_id and lang to match what is in the node table results in the node edit form being populated correctly.

marcoka’s picture

Site is:

- default language: german (default) and english activated (not default)

I updated to 9 beta.
I am using my node 219 as test node. before the update metatags showed up in the edit form. Now they dont.

metatag table: http://i.imgur.com/KpmhOZi.png
node table: http://i.imgur.com/b3KeVDK.png

tell me if you need more data.

marcoka’s picture

is the last update working for people that just use english? i cant find the problem. maybe i am the only on or it will be a problem for every user that switches the language from standard english to X.

marcoka’s picture

debugded around ok found out that the $entity object is missing the metattags data. if i then add new tags and save it will be there next time i debug

found some more confusing stuff. i guess rid here is revision if which is 133 whoch is wrong the node id is 249.
http://i.imgur.com/nHewyvJ.png

1.) Node with redirect
Here we go i found the problem. If we have a node with a redirect (redirect module) it will not load the metatags using function metatag_entity_load. if i kill the redirect and clear all caches/and manually the entity cache tables. the mettags will appear.

2.) Node with nod redirect used
Run update, drush cc all. Visit/edit the node, no meta tags. Go into the database manually and kill all enity cache tables again. Edit the node, meta tags appear.

I tried 2.) with a node with a redirect that works too.

So i can edit a node clear all cache tables and then that node works. problem is i would have to do exactly this for every single node.

Road Kill’s picture

Same problem here after updating from 7.x-1.0-beta4 to 7.x-1.0-beta9 and also tried the dev but no joy.

The Meta tag info is still stored database side even though the fields still display the default as Marcoka said #3, but I have also noticed that if you edit a node and save the default setting then do overwrite the original description and page title which is very worrying.

Some people are also reporting that this is an entity cache problem but I do not have entity cache installed.
I have reverted back to 7.x-1.0-beta4 and will setup test site to test before upgrading again.

Well done to the developers for bringing in the views and panel functionality great job.

Romlam’s picture

StatusFileSize
new728 bytes

Hi,

I've found the problem : a typo in variable name...
See the patch in attachment.

lex0r’s picture

@Romlam, you are awesome!
@ALL: please, use IDEs that underline unused variables :)

greggles’s picture

Title: Metatag data not loading » Typo in variable name causes Metatag data to not load
Status: Active » Needs review

Better status since there is a patch. The change looks reasonable to me.

Status: Needs review » Needs work

The last submitted patch, 11: metatag.i18n.patch, failed testing.

greggles’s picture

Status: Needs work » Needs review
StatusFileSize
new739 bytes

Rerolled. Same change as #11, but created with a git clone - hopefully this will apply.

damienmckenna’s picture

Status: Needs review » Fixed

Thanks for the fix! Committed!

  • Commit 541d08c on 7.x-1.x authored by Romlam, committed by DamienMcKenna:
    Issue #2205675 by Romlam, greggles: Typo in variable name caused data to...
marcoka’s picture

thank you! :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Romlam’s picture

You are welcome !