Changeset 14661

Show
Ignore:
Timestamp:
01/28/08 11:05:33 (10 months ago)
Author:
bergie
Message:

Actually delete the orphans

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/support/find_orphans.php

    r14660 r14661  
    2323//die($_MIDGARD['sitegroup']); 
    2424 
     25echo "Starting...\n"; 
    2526foreach ($_MIDGARD['schema']['types'] as $type => $arr) 
    2627{ 
     
    7980        if (is_orphan($type, $up_value, $parent_value)) 
    8081        { 
    81             echo "    {$type} #{$object_id} is an orphan (up: #{$up_value}, parent: #{$parent_value})\n"; 
     82            echo "    {$type} #{$object_id} is an orphan (up: #{$up_value}, parent: #{$parent_value})"; 
    8283            $orphans++; 
     84            $obj = new $type($object_id); 
     85            echo "      deleting, "; 
     86            $obj->delete(); 
     87            echo mgd_errstr() . "\n"; 
    8388        } 
    8489    } 
     
    8691    echo "  {$orphans} orphans out of " . count($objects) . " {$type} objects\n"; 
    8792} 
     93echo "Done.\n"; 
    8894 
    8995function is_orphan($class, $up_value, $parent_value)