Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Entries Not Saving, Drafts Likely Issue

Status Resolved
Add-on / Version Publisher 2.6.3
Severity
EE Version 3.5.9

Gregory Maher

Sep 11, 2017

Description:
On a Production site we ran into an issue with Entries not correctly saving edits between languages. We discussed this in a boldminded.com ticket here: https://boldminded.com/support/ticket/1533

If content was changed, even in a simple text field for one language, that change overwrote all other languages. We have found a fix for this by Enabling Drafts (which we had disabled previously). Now, when editing an entry the edits stick in their individual languages. However, a message appears “There is a more recent Draft available”. For each entry we are having to manually delete the drafts with Publisher for each entry. It’s almost as those Enable Drafts was assumed enabled during our recent ExpressionEngine/Publisher upgrade but with that feature disabled Entries were not saving correctly. But I could be wrong.

So, what we thought might be related to too many custom fields in ExpressionEngine does still seem to be related to a Drafts issue/topic.

My question here is can we “repair” the database manually by deleting all draft entries in exp_publisher_data (currently 16,434 rows) and/or exp_publisher_titles (currently 16,426 rows) as I manually deleted *some* drafts before I realized enabling Drafts allows me to do it through the control panel.

Detailed steps to reproduce the issue:
1. Choose an MSM site
2. Select a Channel/Entry to Edit
3. Edit the Entry, save, observe the Draft message

In response to preliminary questions:
1) How many custom fields do you have?
A lot. I don’t have a specific count right now, but right on the edge of too many. However, we deleted some and I don’t think this applies.

2) How many entries are in Structure? E.g. a page or a listing? If you make a new template and add just this to it you can take a look at the pages. [exp:publisher:site_pages_debug]
We’re not using Structure. I’ve added that template and can share privately if you think it’s helpful.

3) Are there any ignored channels or fields? (I could also look this up once I login)
There are, but not too many.

#1

BoldMinded (Brian)

FTP info doesn’t appear to work

#2

BoldMinded (Brian)

Can you add that CP login to the review site as well?

#3

BoldMinded (Brian)

Comment has been marked private.

#4

BoldMinded (Brian)

Comment has been marked private.

#5

BoldMinded (Brian)

Comment has been marked private.

#6

BoldMinded (Brian)

I think I may have found the issue with the drafts, just need to update a file on your preview site to verify.

#7

BoldMinded (Brian)

Comment has been marked private.

#8

BoldMinded (Brian)

I think this issue, and #4 from your email (the translation statuses) are fixed on the preview site. I can send a new full build if you like.

Regarding the slow query issue, the category query that is taking several seconds to run I believe is from line 3376 of the mod.channel.php file. Its the only place in EE and in Publisher where I see “DISTINCT (c.cat_id)”, and if you read the code after that line you can see where its assembling this full query. So, I’m not really sure if/how this is a Publisher issue and if I can fix it. Maybe Robin at EL has some insight? I’d be happy to make a change if I can to fix the issue, but seeing that the query is from a core EE file not sure there is much I can do at this point.

SELECT DISTINCT (c.cat_id), c.group_id, c.cat_name, c.cat_url_title, c.cat_description, c.cat_image, c.parent_id, c.cat_order FROM (exp_categories AS c, exp_category_posts ) WHERE c.group_id IN ('3') AND c.cat_id IN (‘15','12','37','38','39','35','36','40','41','13','14') AND c.parent_id = 0 ORDER BY c.group_id, c.parent_id, c.cat_order;

I’m not very good at reading EXPLAIN query results, but maybe EL can make something of it?

EXPLAIN SELECT DISTINCT (c.cat_id), c.group_id, c.cat_name, c.cat_url_title, c.cat_description, c.cat_image, c.parent_id, c.cat_order FROM (exp_categories AS c, exp_category_posts ) WHERE c.group_id IN ('3') AND c.cat_id IN ('15','12','37','38','39','35','36','40','41','13','14') AND c.parent_id = 0 ORDER BY c.group_id, c.parent_id, c.cat_order
id  select_type  table  type  possible_keys  key  key_len  ref  rows  Extra 
1 SIMPLE c index_merge PRIMARY,group_id group_id,PRIMARY 4,4  1 Using intersect(group_id,PRIMARY); Using where; Using temporary; Using filesort
1 SIMPLE exp_category_posts index  PRIMARY 8  64864 Using index; Distinct; Using join buffer (flat, BNL join)

That table only has 2 columns each set as an index. I’m wondering what would happen if you created a composite index to see if it speeds up the query.

ALTER TABLE `exp_category_posts` ADD UNIQUE `entry_cat` (`entry_id`, `cat_id`)

And maybe the same thing on the categories table?

ALTER TABLE `exp_categories` ADD UNIQUE `group_cat` (`group_id`, `cat_id`)
#9

BoldMinded (Brian)

Actually, maybe composite indexes isn’t the right approach. Maybe some of the indexes are actually slowing it down.

Can you send me an .sql dump of just the exp_category_posts and exp_categories table? I’d like to tool around with the indexes to see if I can make it faster.

#10

BoldMinded (Brian)

Greg, did you confirm in the draft issue was fixed? We were emailing back and forth but I don’t recall getting a confirmation on the draft issue. This ticket kind of diverged into a slow query issue 😊

#11

BoldMinded (Brian)

Based on your email it sounds like this draft issue is fixed.

I’ll keep this ticket open for a little longer just incase since it has CP info in it.

#12

BoldMinded (Brian)

Confirmed fixed. Closing!

#13

Gregory Maher

Comment has been marked private.

#14

Gregory Maher

Comment has been marked private.

#15

BoldMinded (Brian)

I don’t have the logins anymore. They’re removed from the DB when a ticket is closed… security and all that. Can you edit the ticket and re-add?

#16

BoldMinded (Brian)

Double check the author_id column value in that entry that isn’t displaying right. See if the value is different in the exp_channel_titles and exp_publisher_titles tables.

#17

BoldMinded (Brian)

If its displaying the title but no other content, it sounds a bit like an sql join is not working correctly b/c it can’t find the correct rows in the db to join and return.

#18

Gregory Maher

Comment has been marked private.

#19

BoldMinded (Brian)

Uh, yeah. Thats not right. Is 9833 a new entry or an old one from the EE2 migration? Try deleting those extra rows and see what happens.

#20

BoldMinded (Brian)

Comment has been marked private.

#21

BoldMinded (Brian)

Comment has been marked private.

#22

BoldMinded (Brian)

The delete draft button may not be showing b/c the query could be failing, so it doesn’t think it has a draft. You may need to delete the rows manually from the db.

#23

BoldMinded (Brian)

Can you try to respond in the ticket instead of directly to the emails? Having comments from a ticket in 2 areas is hard to follow (especially for archival purposes).

Have you tried deleting all of the draft rows and re-creating the draft?

#24

Gregory Maher

Hi Brian, No problem - responses here. I just deleted all traces of Drafts for that entry When viewing the Entry in the CP it still gave me an option to view Draft (that may have to due with Sync Drafts or something?)

I then saved a new Draft and the same issue occurred. The edit did not save to the Draft, and when viewing the Draft there is no Delete button.

Any ideas?

#25

BoldMinded (Brian)

I see 2 drafts in the titles table. Can you delete all the drafts for 9833 again then don’t re-save so I can take a look at it when the entry is in a pristine state?

#26

Gregory Maher

OK, I just deleted them again. The drafts were there from my testing but are now removed.

#27

BoldMinded (Brian)

_titles is still showing a draft https://www.dropbox.com/s/hks0ywpadggv0z9/Screenshot 2017-10-02 11.02.22.png?dl=0

#28

Gregory Maher

OK, sorry about that! It should be all set now. Can you take a look?

Thanks!

#29

BoldMinded (Brian)

Comment has been marked private.

#30

BoldMinded (Brian)

Have you tried creating a bare bones template with only the entries tag in it to load entry 9833 to see if it displays all the content correctly?

#31

Gregory Maher

I have not tried that yet, primarily because it seemed like an issue with the entry itself and the other language versions display correctly. It’s using the products/detail template.

#32

BoldMinded (Brian)

Comment has been marked private.

#33

BoldMinded (Brian)

I assume that debug/draft template is working as you’d expect? If so I would begin by taking that products/detail template and breaking it down piece by piece to see if it starts displaying content from the entry, and if it does then you should know what part of the template could be causing problems (assuming its a template issue, but lets at least do this to rule it out before we spend too much time debugging the back-end).

#34

Gregory Maher

Comment has been marked private.

#35

Gregory Maher

Hi Brian, We recreated the entry on the Production server and things are now working as originally designed. I will let you know if the issue arrises again, but for now I will mark as resolved. Cool?

Thanks!

Greg

#36

Gregory Maher

Hi Brian, I reopened this issue as I think I’m seeing something odd that might help us troubleshoot this moving forward. I recreated the entry from yesterday but then had another issue on our EU MSM site, very similar in nature - the English entry not showing up.

Upon further inspection of the exp_publisher_titles table I noticed that the channel value for the English entry from both of the Entries causing issue was incorrect. Check out your own query above for entry 9833. The site_id is correct, but the first entry is in channel_id 4 and not 78.

This just popped up again with another entry. Changing the channel_id fixes things immediately.

Is there ever a case where an entry would have a language stored in a different channel? If not, might there be an automated way to scan for the issues? Any idea on how they got there in the first place.

Anything I can do to help, just let me know.

Thanks!

Greg

#37

BoldMinded (Brian)

I think there was a bug in the EE2 version where if an entry was re-assigned a new channel it would get out of whack. Were these entries re-assigned in anyway in EE2 or EE3?

#38

Gregory Maher

Hi Brian, I don’t believe these were ever re-assigned. However, only recently did we add a site_id parameter to ALL exp:channel:entries tags, so it’s possible that it wasn’t an issue until that was done. What do you think about an automated way to ensure all entry_ids are assigned to the same channel_id?

Or will it simply be case-by-case as they appear incorrect for site admins and visitors?

Let me know so we can plan accordingly.

Thanks!

Greg

#39

BoldMinded (Brian)

Off hand I’m not sure how to ensure they’re assigned correctly. Some sort of query would probably be the only way to do that.

I’m puzzled how this happened, b/c I don’t recall any other issues in Publisher 1 or 2 where the channel_id was incorrect, except for that bug I mentioned which should have been fixed, but the only way it occurred is if an entry was changed to a new channel (both channels have to share the same field group for this to work b/c of EE restriction).

#40

BoldMinded (Brian)

Are you using anything like DataGrab or any other method of inserting content?

#41

Gregory Maher

Could it have happened when we originally created the MSM sites? When we did so we use the “duplicate channels/entries” option. Maybe they were created with the wrong site ID originally? But then why only some of them?

#42

Gregory Maher

We are not using Datagrab (did not use) for this Channel.

#43

Gregory Maher

Comment has been marked private.

#44

BoldMinded (Brian)

Usually when I hear a bug report I have an idea of what could be causing it, but this one is very odd and I’m not sure where to start other than to run this query to see if other mismatches exist:

select t.entry_id, t.title from exp_publisher_titles as t
join exp_publisher_data as d on t.entry_id = d.entry_id
where t.lang_id = d.lang_id
and t.status = d.status
and t.channel_id != d.channel_id;
#45

Gregory Maher

Comment has been marked private.

#46

BoldMinded (Brian)

Yeah, double check the channel_id values for each of those. Also, see if there may be a pattern, e.g. do they have the same author_id/edit_by values or anything else in common that may lead to a possible cause.

#47

Gregory Maher

Hi Brian, This is an outstanding issue but I’m marking as resolved here as it looks to be very specific to our site.

Thanks for the support!

Greg

Login to reply