Not a developer? Go to MovableType.com

Documentation

MT::BackupRestore::restore

This callback is called when all of the XML files in the particular restore session are restored, thus, when $objects and $deferred would not have any more objects in them. In other words, this callback is invoked when all of the relevant objects have been restored and reconstituted.

This callback is therefore useful for restoring the relationships between two objects. For example, suppose one object may wish to reference or link to another, however during the restoration process it is not guaranteed that the both objects will exist at the time the individual Restore.$Localname:$Namespace callback is invoked. Therefore, this function is called at the very end of the process allowing you to subsequently link related objects to one another.

Input Parameters

  • $cb - a reference to the current MT::Callback object handling this event.
  • $objects - a hash reference which contains all the restored objects in the restore session. The hash keys are stored in the format MT::ObjectClassName#old_id.
  • $deferred - a hash reference which contains information about restore-deferred objects. Deferred objects are those objects which appeared in the XMl file but could not be restored because any parent objects are missing. The hash keys are stored in the format MT::ObjectClassName#old_id and hash values are 1.
  • $errors - an array ref for communicating errors back to the user.
  • $callback - a code reference which will print out the passed parameter. Callback method can use this to communicate with users.

Return Value

None.

Example Handler

sub restore_handler {
    my ($cb, $objects, $deferred, $errors, $callback) = @_;
    if (<error condition>) {
        push @$errors, "My error string.";
    }
}
Back