4 years ago


In a project that started a few years ago, we now see we have issues in the database with the #__cck_core table 

We have several records that have the same pk where they should not!

In our example we have a "actualite" content type with 73 contents in the joomla backoffice (counting every state of the contents)

In the screenshot below we see several records that correspond to one and and only one ACTUALITE content (id = 3419 in the #__content table)

We saw it when we simulate a seblod list query in phpmyadmin :

SELECT t1.title,t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author,t0.author_session AS author_session,t0.cck AS cck,t0.storage_location AS loc,tt.id AS type_id,tt.alias AS type_alias FROM `mz_cck_core` AS t0 LEFT JOIN `mz_content` AS t1 ON t1.id = t0.pk LEFT JOIN `mz_cck_core_types` AS tt ON tt.name = t0.cck WHERE t0.cck = 'actualite' AND t1.language LIKE '%fr-FR%' ORDER BY t1.title ASC

and it gave 246 items where it should be 73 from the joomla backend.

We don't have any clue where it comes but it seems we corrupted the table somehow :( 

Anyway now I am looking for a way to clean the table. Since we have several records with the same PK how can I find the GOOD record (which PID ???) and delete the bad ones ?



Get a Book for SEBLOD