[Turn off line numbering]1: arg ver; 2: var obj, obj2, d, o, top, x, admin, tmp, name; 3: 4: // core rooms should be +core, and can't be destroyed 5: // traverse the list inversely, less unseen hierarchical shuffling 6: .add_var('__making_core); 7: dblog("** Starting Core Extraction " + ctime()); 8: d = $root.descendants(); 9: top = listlen(d); 10: core_version = ver; 11: dblog("** " + top + " objects total, tidying up core objects..."); 12: 13: // tidy up core objects first 14: for obj in (d) { 15: refresh(); 16: if (obj.has_flag('core)) { 17: tmp++; 18: catch any { 19: obj.change_manager(obj); 20: for o in (obj.writers('literal)) { 21: refresh(); 22: obj.del_writer(o); 23: } 24: } with { 25: dblog("** TIDY " + obj + " traceback: "); 26: for o in ($parse_lib.traceback(traceback())) 27: dblog("** " + o); 28: } 29: } 30: } 31: 32: // nuke anything not core 33: dblog("** " + tmp + " core objects, destroying non-core objects..."); 34: for x in [1 .. top] { 35: pause(); 36: obj = d[top - x + 1]; 37: if (!valid(obj)) { 38: // dblog(".. Skipping invalid object " + obj); 39: continue; 40: } 41: if (!obj.has_flag('core)) { 42: if (obj.children()) { 43: for obj2 in (obj.children()) { 44: if (obj2.has_flag('core)) { 45: dblog("** ABORTING: A NON CORE OBJECT HAS CORE CHILDREN: "); 46: dblog("** " + obj + " => " + obj.children()); 47: shutdown(); 48: } 49: } 50: } 51: catch any { 52: // dblog(".. Destroying " + obj); 53: obj.destroy(); 54: } with { 55: dblog("** " + obj + ".destroy() traceback: "); 56: for o in ($parse_lib.traceback(traceback())) 57: dblog("** " + o); 58: } 59: } 60: } 61: 62: // shutdown this task so that references can have 63: // a chance to clear out, on destroyed objects. 64: dblog("** done, suspending for new task **"); 65: 66: // do this the hard way, to be secure--wait a little while for 67: // things to wrapup, five seconds should be fine. 68: pause(); 69: set_heartbeat(5); 70: .add_var('TMP_HEARTBEAT_CODE, .list_method('heartbeat)); 71: .add_method([".finish_core();"], 'heartbeat);
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit