$backup

Collection of functions for managing scheduled background backups.
Syntax
    $backup{}
Documentation$backup:
Collection of functions for managing scheduled backups. Don't use this function directly, use one of it's subfunctions instead.

SITEFORUM allows scheduled backups which do not require to shutdown the server. The resources to backup are defined in backup rules via the $backup.setup functions or more easy via the Studio backup manager module.

The strategy SITEFORUM uses for backups is as follows: 1.) new transactions are blocked until all needet resources are released. 2.) The resources which will get backed up get a backup lock 3.) normal operation continues and the blocked transactions get initiated 4.) If a transaction requires write access to a resource which is scheduled for backup a request to the backup process is made to immediately backup it and release the backup lock. This strategy assures minimal downtime and a coherent backup/snapshot.

Examples
$/* For a more complex example you'd might want to look at the code of the Studio backup manager module. $*/ $io.sendBytes{1}{} $// backup $if{$existsCurrent{backup}}{ $io.sendBytes{1}{Adding backup rule.
} $backup.setup.add{backup_test}{1}{$getCurrent{i}}{public://index.html}{0} $io.sendBytes{1}{Account list: $backup.setup.getAccountList{backup_test}
} $io.sendBytes{1}{Interval: $backup.setup.getInterval{backup_test}
} $io.sendBytes{1}{Paths: $backup.setup.getPathList{backup_test}
} $io.sendBytes{1}{Enabled: $if{$backup.setup.isEnabled{backup_test}}{Yes}{No}
} $io.sendBytes{1}{Committing transaction.
} $commit{NONE} $io.sendBytes{1}{Flagging backup start.
} $backup.start{backup_test} $io.sendBytes{1}{Now waiting for backup to start. This may take a while.
} $while{$isEmpty{$backup.getLastFile{backup_test}}}{ $io.sendBytes{1}{Waiting 5 sec...
} $sleep{5000} } } { Backup this account now.

} $// restore $if{$existsCurrent{restore}}{ $set{file}{$backup.getLastFile{backup_test}} File: $get{file}
Account id list: $backup.restore.getStoredAccounts{$get{file}}
File list: $backup.restore.getStoredFiles{$get{file}}
$if{$existsCurrent{restore}}{ $backup.restore.apply{$get{file}} } Restored.
} { Restore now.

} $// remove rule $if{$existsCurrent{remove}} { $backup.setup.remove{backup_test} } { $if{$backup.setup.exists{backup_test}}{Remove test backup rule.

} }

GroupSpecial
Minimum required transaction-mode:NONE
Required scripting permission of the developerPERMISSION_FL_ADMINISTRATIVE
Minimum parameters0
Maximum parameters 0