Method code for $sys.do_backup()

[Turn on line numbering]
arg @args;
var line, who, how, name, dirty;

(> .perms(sender(), 'system) <);
if (dict_contains(backup, 'started)) {
    .log("BACKUP CONFLICT");
    line = "BACKUP CONFLICT at " + $time.format("%r");
    line += ", Current backup started at " + $time.format("%r", backup['started]);
    $channel_ui._broadcast('System, line);
    return;
}
dirty = .dirty();
[(who ?= sender()), (how ?= 'request)] = args;
if (!valid(who))
    who = sender();
backup = backup.add('next, time() + backup['interval]);
backup = backup.add('last, time());
if (how == 'interval && !dirty)
    return;
catch any {
    name = who.namef('ref);
    .log("BACKUP (" + name + ") ");
    line = "Backup started at " + $time.format("%r") + " by " + name;
    $channel_ui._broadcast('System, line);
}

// double pause will hopefully let people know about it before it happens
pause();
pause();
backup = backup.add('started, time());
(> backup() <);

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

the Cold Dark