Last active
December 15, 2015 13:48
-
-
Save iAugur/5269584 to your computer and use it in GitHub Desktop.
The entity_translation status does not get updated when the node status changes - This can lead to the main language translation not appearing - see http://technology.blue-bag.com/entity-translations-and-published-status-flag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Get a list of nodes where the entity_translation status is not in sync | |
| * Note we only get the unpublished translations as it is the node status we are concerned with | |
| * We are also only interested in the source translations | |
| **/ | |
| select node.status, et.status | |
| from entity_translation et | |
| inner join .node on node.nid = et.entity_id and et.entity_type = 'node' | |
| where node.status <> et.status and et.status = 0 and et.source = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Update Entity_translations for node status | |
| * Only update the source records and then only those that are unpublished | |
| **/ | |
| UPDATE entity_translation et | |
| inner join node n on n.nid = et.entity_id and et.entity_type = 'node' | |
| SET et.status= 1 | |
| where n.status <> et.status and et.status = 0 and et.source = ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment