Hi,

We encounter a very critical issue about Metatag (and Revision) on our production website. Let me explain how to reproduce it:

  • We create a node with a specific metatag such as 'description'
  • We save it and publish it -> it creates a base revision
  • We create another revision with some modifications but we didn't publish it
  • The metatags are present in the unpublished revision but we lost them in the current publish version

Have you heard about this issue?

Technical information:

  • Revisioning: 7.x-1.6
  • Metatag: 7.x-1.0-beta9

Thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

standingtall’s picture

This is same as this https://drupal.org/node/2184979

Current version of meta tag is full of bugs.

blazingarrow’s picture

See https://drupal.org/comment/8371977#comment-8371977 for the solution. It's quite simple, just disable Global: Front page settings, in admin/config/search/metatags and the settings from node will be used.

madchris’s picture

Hi,

I think I've found something.
In the metatag.module file, the metatag_metatags_save() function makes a db_delete('metatag') but without a "revision_id" condition. So if you are working with revisions, and if your metatags datas are empty, you will lose all your metatags datas for the node and all its revisions.

Wouldn't it be better to add the line "->condition('revision_id', $revision_id)" to the query, if $revision_id !=0 ?

camille.maniez’s picture

SebCorbin’s picture

Title: Revision issue » Deletes whole content when metatags for a revision are empty
Status: Active » Needs review
FileSize
451 bytes

Comment #3 has it.

  // If the data array is empty, there is no data to actually save, so just
  // delete the record from the database.
  if (empty($metatags)) {
    db_delete('metatag')
      ->condition('entity_type', $entity_type)
      ->condition('entity_id', $entity_id)
      ->condition('language', $langcode)
      ->execute();
  }

Bumping to critical priority as it deletes data. Patch attached.

SebCorbin’s picture

Priority: Normal » Critical
Maxime Gilbert’s picture

Status: Needs review » Reviewed & tested by the community

This works like a charm: must be released.

greggles’s picture

Title: Deletes whole content when metatags for a revision are empty » Deletes all metatag content when metatags for a revision are empty

Slightly better title. I agree this looks like a pretty bad bug.

Any comment from the maintainers on this patch?

  • Commit 4e6e862 on 7.x-1.x authored by SebCorbin, committed by DamienMcKenna:
    Issue #2237507 by SebCorbin: Only delete all records when editing one...
DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -revision, -unpublished, -metatag

Committed. Sorry for letting that slip in :(

Status: Fixed » Closed (fixed)

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