août
2012
J’ai réussi à mettre eZ Publish dans un état instable.
J’avais quelques objets sans nœuds associés, ce qui provoque des comportements bizarres.
J’avais alors corrigé ma BDD à la main. Mais suite à la rédaction de cet article, Alexandre SEBBANE m’a fait remarqué la présence du script bin/php/flatten.php.
Ce script a pour but de supprimer de la BDD les informations non utilisées. Il peut s’agir des contentobject, contentclass, workflow, role ou de tout.
Pour nettoyer les objets sans nœuds associés, il faudrait essayer la ligne de commande ci-dessous.
Par contre, vous allez supprimer toutes les anciennes versions des objets publiés et les brouillons encore non-publiés :
Si ça ne marche pas, vous pouvez toujours faire comme moi. Exécutez plusieurs fois la commande SQL ci-dessous pour supprimer les nœuds sans parent :
( SELECT * FROM
(SELECT node_id FROM ezcontentobject_tree)
tmp );
Puis exécutez les commandes SQL ci-dessous pour supprimer les objets qui n’ont pas de nœuds associés :
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcontentobject_version WHERE contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcontentobject_name WHERE contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcobj_state_link WHERE contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcontentobject WHERE id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM eznode_assignment WHERE contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcontentobject_link WHERE from_contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcontentobject_link WHERE to_contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
DELETE FROM ezcontentobject_trash WHERE contentobject_id NOT IN
(SELECT contentobject_id FROM ezcontentobject_tree);
Ce n’est pas une solution propre, mais ça peut dépanner.
Pour éviter ce genre de soucis, prennez l’habitude de faire des sauvegarder régulières de vos BDD
En espérant que ça puisse vous aider,
Thomas.