<<

NAME

MT::BackupRestore

METHODS

backup

TODO Backup MT::Tag, MT::Author, MT::Blog, MT::Role, MT::Category, MT::Asset, and MT::Entry. Each object will be back up by MT::Object#to_xml call, which will do the actual Object ==>> XML serialization.

restore_file

TODO Restore MT system from an XML file which contains MT backup information (created by backup subroutine).

restore_process_single_file

TODO A method which will do the actual heavy lifting of the process to restore objects from an XML file. Returns array of blog_ids which are restored in the very session, and hash of asset_ids.

restore_directory

TODO A method which reads specified directory, find a manifest file, and do the multi-file restore operation directed by the manifest file.

restore_asset

TODO A method which restores the assets' actual files to the specified directory. It also creates subdirectory by request.

process_manifest

TODO A method which is called from MT::App::CMS to process an uploaded manifest file which is to be the source of the multi-file restore operation in the MT::App::CMS.

Callbacks

For plugins which uses MT::Object-derived types, backup and restore operation call callbacks for plugins to inject XMLs so they are also backup, and read XML to restore objects so they are also restored.

Callbacks called by the package are as follows:

Backup

Calling convention is:

    callback($cb, $blog_ids, $progress)

The callback is used for MT::Object-derived types used by plugins to be backup. The callback must return the object's XML representation in a string, or 1 for nothing. $blog_ids has an ARRAY reference to blog_ids which indicates what weblog a user chose to backup. It may be an empty array if a user chose Everything. $progress is a CODEREF used to report progress to the user.

If a plugin has an MT::Object derived type, the plugin will register a callback to Backup callback, and Backup process will call the callbacks to give plugins a chance to add their own data to the backup file. Otherwise, plugin's object classes is likely be ignored in backup operation.

Restore

Restore callbacks are called in convention like below:

    callback($cb, $data, $objects, $deferred, $callback);

Where $data is a parameter which was passed to XML::SAX::Base's start_element callback method.

$objects is an hash reference which contains all the restored objects in the restore session. The hash keys are stored in the format MT::ObjectClassName#old_id, and hash values are object reference of the actually restored objects (with new id). Old ids are ids which are stored in the XML files, while new ids are ids which are restored.

$deferred is an 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.

$callback is a code reference which will print out the passed paramter. Callback method can use this to communicate with users.

If a plugin has an MT::Object derived type, the plugin will register a callback to Restore.<element_name>:<xmlnamespace> callback, so later the restore operation will call the callback function with parameters described above. XML Namespace is required to be registered, so an xml node can be resolved into what plugins to be called back, and can be distinguished the same element name with each other.

AUTHOR & COPYRIGHT

Please see "AUTHOR & COPYRIGHT" in MT.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 1031:

You forgot a '=back' before '=head1'

<<