? ? Pending

User tests: Successful: Unsuccessful:

avatar sanderpotjer
sanderpotjer
25 Aug 2017

Pull Request for Issue #13602 #14824.

Summary of Changes

This PR adds the _getAssetName, _getAssetTitle and _getAssetParentId methods to the Language table class. Prevents storing corrupt asset enties to the #__assets table.

Testing Instructions

Go to Extensions -> Language(s) -> Content Languages, open one of the languages and save it. Check the #__assets table and you will notice an entry like:
screen shot 2017-08-25 at 13 39 07

Notice that the parent_id points to asset root.1, the level is 1 and the name and title are not set correctly.

Apply the patch and save the language again. Now the assets table shows an entry like:
screen shot 2017-08-25 at 13 39 28

Expected result

The PR makes sure the correct asset data is set. So:

  • parent_id: should be ID of com_languages asset
  • level: should be 2
  • name: should be com_languages.language.X (where X is ID of language)
  • title: should be equal to language title, so e.g. English (en-GB)
avatar joomla-cms-bot joomla-cms-bot - change - 25 Aug 2017
Category Libraries
avatar sanderpotjer sanderpotjer - open - 25 Aug 2017
avatar sanderpotjer sanderpotjer - change - 25 Aug 2017
Status New Pending
avatar infograf768
infograf768 - comment - 25 Aug 2017

Thanks for working on this. No idea how to test though.

avatar mbabker
mbabker - comment - 25 Aug 2017

Add content languages. Check the assets records for those to ensure they have a correct title and inherit from the com_languages component.

avatar infograf768 infograf768 - test_item - 25 Aug 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 25 Aug 2017

I have tested this item successfully on 29d7993

screen shot 2017-08-25 at 17 26 04


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17716.
avatar infograf768
infograf768 - comment - 25 Aug 2017

Question: what can we do concerning existing content languages with wrong asset?
Any special message or else?

avatar alikon alikon - test_item - 26 Aug 2017 - Tested successfully
avatar alikon
alikon - comment - 26 Aug 2017

I have tested this item successfully on 29d7993


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17716.

avatar infograf768 infograf768 - change - 26 Aug 2017
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 26 Aug 2017

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17716.

avatar alikon
alikon - comment - 26 Aug 2017

@infograf768 not sure if we can do something safe for broken asset

avatar infograf768
infograf768 - comment - 26 Aug 2017

@sanderpotjer or committer : can you make drone happy?

avatar sanderpotjer sanderpotjer - change - 26 Aug 2017
Labels Added: ?
avatar sanderpotjer
sanderpotjer - comment - 26 Aug 2017

@infograf768 done.

For removing the wrong assets an option is to include an update script like if we want:

DELETE FROM `#__assets` WHERE `name` LIKE '#__languages.%';
avatar ggppdk
ggppdk - comment - 26 Aug 2017

For removing the wrong assets an option is to include an update script like if we want:

DELETE FROM #__assets WHERE name LIKE '#__languages.%';

Since language assets are not being used in J3.7.x
the above seems safe , right ?

avatar infograf768
infograf768 - comment - 26 Aug 2017

They may not be used indeed until someone refactors this for 4.x
See my explanation and link to POC #13602 (comment)

avatar mbabker
mbabker - comment - 26 Aug 2017

Since language assets are not being used in J3.7.x
the above seems safe , right ?

No. Without correcting the tree values you corrupt the table.

avatar ggppdk
ggppdk - comment - 26 Aug 2017

Since language assets are not being used in J3.7.x
the above seems safe , right ?

No. Without correcting the tree values you corrupt the table.

True in the general case,
but in this case the deleted assets '#__languages.nn' have no childs , they are leaves of the tree
so there should be no corrruption, right ?

avatar mbabker
mbabker - comment - 26 Aug 2017

There's still a gap in the lft/rgt columns making it easier for the tree to be broken.

avatar ggppdk
ggppdk - comment - 26 Aug 2017

There's still a gap in the lft/rgt columns making it easier for the tree to be broken

so what should be done ?
is an sql query with a REPLACE() on the assets with name '#__languages.%' enough ?
like

UPDATE #__assets SET name = REPLACE(name, '#__languages.', 'com_languages.language.');

at least the above should fix the asset names ?
(but not the asset title, asset title will be ok the next language is saved ?)

avatar mbabker mbabker - change - 30 Aug 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-08-30 11:56:43
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 30 Aug 2017
avatar mbabker mbabker - merge - 30 Aug 2017

Add a Comment

Login with GitHub to post a comment