core icon indicating copy to clipboard operation
core copied to clipboard

Can't delete multi-lingual content

Open Xander-Steinmann opened this issue 11 years ago • 9 comments

When you have content available in multiple languages, for instance an English and a Spanish version, you can't delete the content any more. When you unpublish and archive the Spanish version it can't be deleted because of the following message:

WARN business.ESContentletAPIImpl: Cannot delete content that has a working copy in another language

But when you also unpublish and archive the other versions you still get this message. Therefore it is impossible to delete the content from the system.

This can be reproduced on the demo website:

  1. Create a new Content (Generic) in English called "test"
  2. Open the content and create a Spanish version by changing the language. Save/publish it
  3. unpublish the EN and ES versions of "test"
  4. archive the EN and ES versions of "test"
  5. Now try to delete one or both of them

After you try this you'll notice that they're still archived. When you look at the versions of the content they're displayed as 'working' (orange circle) instead of 'archived' (red circle)

Xander-Steinmann avatar Oct 22 '15 09:10 Xander-Steinmann

Note that trying to delete with the Maintenance Page "delete by identifier" also doesn't work. DotCMS says it deletes multiple content but it doesn't.

Xander-Steinmann avatar Oct 27 '15 07:10 Xander-Steinmann

This is causing us major issues in 3.2.3 and I can verify it is a reproducible issue on the demo site currently, any word on a fix or workaround?

Screencast: http://screencast.com/t/Q8GalfxBF

cfalzone avatar Oct 28 '15 18:10 cfalzone

not yet @cfalzone probably 3.3.1 or so. Just an index thing I think

jtesser avatar Oct 28 '15 18:10 jtesser

It looks like it checks in the DB for an other version history with a working version.

So it sees the other version history and throws an error:

dotcms=# select * from contentlet_version_info where identifier='c6352db8-e0d9-4154-a7d7-a928f5b87d59';
              identifier              | lang |            working_inode             |              live_inode              | deleted | locked_by |       locked_on        |       version_ts       
--------------------------------------+------+--------------------------------------+--------------------------------------+---------+-----------+------------------------+------------------------
 c6352db8-e0d9-4154-a7d7-a928f5b87d59 |    1 | 1440f910-27a0-4712-8a9d-7e4c3bc249fc |                                      | t       |           | 28-OCT-15 14:31:08.904 | 28-OCT-15 14:33:13.629
 c6352db8-e0d9-4154-a7d7-a928f5b87d59 |    4 | c1a6e7d3-cc9a-4ade-856c-0ab6e754a019 | c1a6e7d3-cc9a-4ade-856c-0ab6e754a019 | f       |           | 28-OCT-15 14:30:06.69  | 28-OCT-15 14:33:58.836

cfalzone avatar Oct 28 '15 18:10 cfalzone

Weird that is seems like isArchived() should return true here: https://github.com/dotCMS/core/blob/master-3.3/src/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java#L1223

I haven't stepped through the code though to see if that is the case or not.

cfalzone avatar Oct 28 '15 19:10 cfalzone

Maybe that's the problem? When you look at the versions/history the archived items are displayed as yellow instead of red. I can understand that you aren't allowed to delete when dotCMS thinks the other versions aren't archived.

Xander-Steinmann avatar Oct 29 '15 07:10 Xander-Steinmann

So I realize now that in the master I think this might* not be a problem .. I haven't spun up a master-3.3 to test it.

The code in question I think is here on the 3.2.3 branch:
https://github.com/dotCMS/core/blob/3.2.3/src/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java#L1149

I think if we add a && !contentlet.isArchived() to that if statement it fixes the issue right?

I don't really understand what the If statement on line 1150 is trying to accomplish though .. doesn't seem to me like that would ever be true based on the conditions we get there by.

cfalzone avatar Oct 30 '15 15:10 cfalzone

As I figured, this issue is already resolved in the latest master here: #7844 with this commit:

https://github.com/dotCMS/core/commit/edd876d304e46f4400c5ff8a640e926700d642d6

cfalzone avatar Oct 30 '15 19:10 cfalzone

closing as a duplicate. Thanx for the followup @cfalzone

jtesser avatar Oct 30 '15 19:10 jtesser