Getting deleting orphans from ezcontentobject and ezcontentobject_tree

Author Message

Erik Weinmaster

Monday 29 March 2010 9:34:38 am

Hello,

I created a different delete function, which purges an object if the main node is selected to be deleted (the subtree is deleted too), otherwise just the tree node is removed. However, before I was able to fully implement this, I notice that there have been orphaned records in ezcontentobject and ezcontentobject_tree.

I guess I have one simple question. Can an Object exist without a corresponding record in ezcontentobject_tree? From what I find, I'd say no, because how would you get to this object? But I'd like some confirmation too. Please.

Also, here are the two queries I am using to find orphaned records.

Type 1: No corresponding tree node

SELECT DISTINCT co.id

FROM ezcontentobject co

LEFT JOIN ezcontentobject_tree cot ON co.id = cot.contentobject_id

WHERE node_id IS NULL

Type 2: No parent node

SELECT DISTINCT contentobject_id AS id

FROM ezcontentobject_tree

WHERE parent_node_id NOT IN (SELECT DISTINCT node_id FROM ezcontentobject_tree)

Do these queries look right?

Thanks

Robin Muilwijk

Monday 29 March 2010 11:05:40 am

Hi,

I saw a post about orphans some time ago, so sharing here in case it's worth something for you to compare your own sql scripts: http://share.ez.no/forums/developer/zombie-check-script/%28language%29/eng-GB

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 16:33:38
Script start
Timing: Jan 30 2025 16:33:38
Module start 'layout'
Timing: Jan 30 2025 16:33:38
Module start 'content'
Timing: Jan 30 2025 16:33:38
Module end 'content'
Timing: Jan 30 2025 16:33:38
Script end

Main resources:

Total runtime0.0275 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 588.6172151.2734
Module start 'layout' 0.00790.0053 739.8906220.7500
Module start 'content' 0.01310.0126 960.6406997.7578
Module end 'content' 0.02570.0018 1,958.398429.9922
Script end 0.0275  1,988.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00279.7738140.0002
Check MTime0.00103.5571140.0001
Mysql Total
Database connection0.00145.065410.0014
Mysqli_queries0.004817.270130.0016
Looping result0.00000.065810.0000
Template Total0.00145.110.0014
Template load0.00113.847310.0011
Template processing0.00031.246610.0003
Override
Cache load0.00072.365010.0007
General
dbfile0.00031.028380.0000
String conversion0.00000.032940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs