Method code for $sys.clean_database()

[Turn on line numbering]
var obj, p, c, cmd;

// cleanup some of $root's messiness
for obj in ($root.descendants()) {
    (| obj.clean_root() |);
    refresh();
}

// purge all command caches
for obj in ($command_cache.descendants()) {
    (| obj.purge_cache() |);
    refresh();
}

// check user info (move'em home etc)
for obj in ($user.descendants()) {
    if ((| obj.home() != obj.location() |))
        (| obj.move_to(obj.home()) |);
    refresh();
}

// validate all locations and location content's
for obj in ($physical.descendants()) {
    (| obj.validate_contents() |);
    if (obj.has_ancestor($located)) {
        if (!valid(obj.location()) || !(obj in obj.location().contents()))
            (| obj.move_to((| obj.home() |) || $lost_and_found) |);
    }
    refresh();
}

// $#Edited: 02 Nov 98 07:14 $brandon

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark