trash count[SOLVED]

Author Message

Mads Ovesen

Wednesday 09 November 2005 3:45:04 am

I have a problem with the trash in admin. Even though there are only 20 objects in the trashcan, the trash_count function thinks there are 400. This causes the google to make a lot of empty pages. Does anyone know whats wrong and how to fix this problem?

- Thx

/m

Ɓukasz Serwatka

Tuesday 13 December 2005 11:54:05 pm

Hi Mads,

Could you post your solution here?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Mads Ovesen

Monday 19 December 2005 3:04:48 am

Sure, I was going to, but just forgot about it. There are two functions controlling the trash in trash.tpl:
1) Trash_count fetches the number of items in the trash (objects with status 2 in the ezcontentobject table).
2) Trash_object_list fetches the trashed objects (also status 2).

The integer returned by trash_count is different compared to the number of objects returned by trash_object_list in version 3.4.8. The reason is that the trash_object_list function is based on each user while trash_count is based on the global trash. I can't come up with a reason why this is so, so I made trash_count function count only the trash objects of each user by editing the following in kernel/content/ezcontentfunctioncollection.php to the following:

function fetchTrashObjectCount()
    {
        $userID = ezUser::currentUserID();
        $trashObjectList = &eZPersistentObject::fetchObjectList( 
                       eZContentObject::definition(), array(), 
                       array( 'status' => EZ_CONTENT_OBJECT_STATUS_ARCHIVED, 'owner_id' => $userID ), 
                       array(), null, false,false, 
                       array( array( 'operation' => 'count( * )',                                                                                                                                                        
                       'name' => 'count' ) ) );     

return array( 'result' => $trashObjectList[0]['count'] );
}

/m

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 18 2025 16:21:02
Script start
Timing: Jan 18 2025 16:21:02
Module start 'layout'
Timing: Jan 18 2025 16:21:02
Module start 'content'
Timing: Jan 18 2025 16:21:03
Module end 'content'
Timing: Jan 18 2025 16:21:03
Script end

Main resources:

Total runtime0.9731 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.8906152.6094
Module start 'layout' 0.00590.0020 740.500039.4141
Module start 'content' 0.00790.9637 779.9141537.0156
Module end 'content' 0.97150.0016 1,316.929712.1875
Script end 0.9731  1,329.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3442160.0002
Check MTime0.00130.1386160.0001
Mysql Total
Database connection0.00080.084810.0008
Mysqli_queries0.928395.3965570.0163
Looping result0.00050.0531550.0000
Template Total0.942996.920.4715
Template load0.00220.225920.0011
Template processing0.940796.667520.4704
Template load and register function0.00040.040710.0004
states
state_id_array0.00080.083810.0008
state_identifier_array0.00120.127820.0006
Override
Cache load0.00180.1846150.0001
Sytem overhead
Fetch class attribute can translate value0.00060.057020.0003
Fetch class attribute name0.00090.097440.0002
XML
Image XML parsing0.00070.072320.0004
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00080.0808180.0000
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs