Changeset 17909

Show
Ignore:
Timestamp:
10/03/08 19:37:54 (2 months ago)
Author:
rambo
Message:

cache invalidates on succesfull undelete, fixes #325

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.core/midcom/baseclasses/core/dbobject.php

    r17804 r17909  
    703703                { 
    704704                    $undeleted = true; 
     705                    // refresh 
     706                    $object = $_MIDCOM->dbfactory->get_object_by_guid($guid); 
    705707                } 
    706708            } 
     
    710712                { 
    711713                    $undeleted = true; 
     714                    // refresh 
     715                    $object = $_MIDCOM->dbfactory->get_object_by_guid($guid); 
    712716                } 
    713717            } 
     
    718722                debug_pop(); 
    719723            } 
     724            else 
     725            { 
     726                $parent = $object->get_parent(); 
     727                if (   $parent 
     728                    && $parent->guid) 
     729                { 
     730                    // Invalidate parent from cache so content caches have chance to react 
     731                    $_MIDCOM->cache->invalidate($parent->guid); 
     732                } 
     733                 
     734                // Invalidate Midgard pagecache if we touched style/page element 
     735                if (   function_exists('mgd_cache_invalidate') 
     736                    && (   is_a($object, 'midgard_element') 
     737                        || is_a($object, 'midgard_pageelement')) 
     738                    ) 
     739                { 
     740                    mgd_cache_invalidate(); 
     741                } 
     742            } 
    720743            $stats[$guid] = $undeleted; 
    721              
     744 
    722745            // FIXME: We should only undelete parameters & attachments deleted inside some small window of the main objects delete 
    723746            debug_push_class(__CLASS__, __FUNCTION__); 
     
    730753            midcom_baseclasses_core_dbobject::undelete_attachments($guid); 
    731754 
     755            //FIXME: are we sure we want to undelete all children here unconditionally, shouldn't it be left as UI decision ?? 
    732756            // List all deleted children 
    733757            $children_types = $ref->get_child_objects($object, true);