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: Publisher Draft to Published saving creates dupliate blocks

Status Resolved
Add-on / Version Bloqs 4.6.0
Severity
EE Version 5.3.2

Andrew Studios

Mar 18, 2021

Hey Brian,

This issue is for both Publisher Lite (latest version) and Bloqs (latest version). I’ve tested on this site with both EE5.3.2 ... and I upgraded my local version to 5.4.2 (I can’t update prod just yet), and the issue remains. I’ve tried PHP 7.2.2, 7.3.9 and 7.4.2.

When saving an entry from Draft to Published (or vise-versa) ... the Bloqs are copied across ... but the destination Bloqs are not removed. So if Draft and Published are idential (lets say there are 2 bloqs on draft, and the same on published), and then I save the Draft version as Published ... it ends up with 4 bloqs on published version (the original 2, and the ones from draft).

If I just save draft to draft (or published to published) ... it saves fine.

It seems that the destination bloqs are not deleted from the database.

We were not having this issue in previous versions of Bloqs/Publisher, using the same EE version.

I’m happy to do more testing, but can you give me a heads up with where to start looking in either addon?

Thanks in advance.

#1

BoldMinded (Brian)

Please share screenshots of your Publisher persistence settings page. You added a cp url but no user or pass.

#2

BoldMinded (Brian)

Does this happen in every entry? Please be specific of where I should go if I login to your cp to see the issue occur. This sounds odd because I have not seen such a behavior happen and I’m running both new versions in 2 different sites.

#3

Andrew Gunstone

Yes. Seems to happen with any entry, any channel (that is managed by Publisher, and has a Bloqs field).

I’ve not seen it before either. I can’t figure out where the bloqs are deleted when moving from Draft -> Published (I tried looking at the the blocks_delete_block hooks in Publisher_bloqs_hooks.php but they didn’t seem to fire when saving an entry).

I’ll shoot over the login details, but please note that this is a prod server (I can setup a staging if we need).

#4

BoldMinded (Brian)

Yeah I’m unable to replicate this. Are you 100% positive all the add-on files were updated correctly? There wasn’t a folder merger gone wrong and maybe some old files still exist?

#5

BoldMinded (Brian)

Comment has been marked private.

#6

BoldMinded (Brian)

Can you create a video so I can see the behavior happening? I tried editing a test entry and everything seemed fine… cp/publish/edit/entry/33287

#7

Andrew Gunstone

Hey mate. I’ve tried the slightly newer builds (locally) and I’m still getting the same issue. My gut feeling is that it’s actually something else that is causing the issue. I’m going to start removing other extensions/addons to see what happens.

Hold tight on this one. I’ll let you know how I go. If it still happens, then I’ll do the video for you.

Thanks for your help and advice so far. It’s appreciated.

#8

Andrew Gunstone

Hey Brian,

I’ve found the issue. After a lot of mucking about this afternoon, I finally rolled back to a previous version of Bloqs(4.4.0) and Publisher (3.2.2), and also a previous database. These versions of the addons worked fine for me.

I then installed Bloqs … which worked fine. I rolled back again, and installed Publisher. This did not work. I took a look at the changes, and figured out that the issue was in - system/user/addons/publisher/legacy/libraries/hooks/Publisher_bloqs_hooks.php at around line 346 (in the blocks_pre_save_blocks function).

The code for deleting the old blocks had been removed, and the old blocks were now saved in a “blocks_pre_save_blocks” cache. I don’t think that cache is actually used anywhere.

I’ve now changed my version to:

if (!empty($blocks)) { $db->where_in(‘id’, $blocks)->delete(‘blocks_block’); $db->where_in(‘block_id’, $blocks)->delete(‘blocks_atom’); ee()->session->cache[‘publisher’][‘blocks_pre_save_blocks’] = $blocks; }

And it works fine for me.

To re-produce this, save an entry from Published -> Draft (I think checked the exp_blocks_block table to make sure that worked), then save the same entry AGAIN with Published -> Draft … it doubles up on all blocks.

Phew! This all works for me now. Hopefully it helps someone else.

😊

#9

BoldMinded (Brian)

The code for deleting blocks should be removed. It wasn’t necessary and overly complicated things, and had other side effects. I won’t be adding that back to the official version.

Make sure the cp login works bc I’m going to take a look at your settings.

#10

BoldMinded (Brian)

This is all very peculiar because I’ve had the same versions of publisher and blogs running in 2 different sites for awhile now and this issue isn’t occurring. Not only is it not occurring I can’t intentionally replicate it.

#11

BoldMinded (Brian)

Can you provide for access to a non prod env where this is happening too? This just isn’t adding up.

#12

Andrew Gunstone

Yeah … agree. It’s super weird.

One thing I should probably note … this was an EE2 site, upgraded to EE5. It has had Publisher and Bloqs in it for a while, and they have been upgraded fairly consistently. Whilst this in theory shouldn’t make a difference … we all know that it may! I’ll also note that yesterday, that on a local version I removed ALL addons and fields except Bloqs and Publisher (and I confirmed in the exp_extensions table that they were the only ones present), and it was still happening.

Give me today to get a staging site setup for you. I may need to get you to send me a public key that I can add to the server.

In good news … the client is happy that the issue is temporarily sorted. 😊

#13

BoldMinded (Brian)

Comment has been marked private.

#14

BoldMinded (Brian)

Closing this out because I can’t replicate it, and no other similar bugs have been reported since.

Login to reply