uSync.Exporter
uSync.Exporter provides a dashboard and context menu items that let you build your own 'SyncPack' exports. It contains just the elements you need, in order to move items between Umbraco instances.
Options
When creating an export, you will be presented with several options.
Dependencies
When you include an item in an export via Exporter you will be presented with the option to include dependencies.
When dependencies are included, Exporter will calculate the items and settings required to fully import something to another Umbraco installation. These will include doctypes, datatypes, templates, and any other elements needed.
Include Media Files
If selected, the export will also include any physical media required to import a media item.
If not selected, the Umbraco media item will still need to be synced, but the physical image or file will not be included.
Exclude/Include Templates
If you include templates, the export will include all the files, views, CSS, and script folders from the site. On import, these will be compared with those of the target site, and changes will only be made when files are different.
Include Linked Items
Including linked items means the export will include any other content pages that are linked to, from the pages requested. This can result in a large number of pages being synced but ensures that all links within content will be maintained between sites.
Exporter-Specific Handler Settings.
By default, the exporter UI and process will use the "Exporter" handler configuration for uSync. The defaults for this handler are often all you need and you will not need change them.
If you do need to change the Handler set settings for Exporter you can do so by adding a new Handler set entry to the uSync Handler settings.
{
"uSync": {
"Exporter": {
"Handlers": {
... specific settings for exporter
}
}
}
}
Exporter Settings
In general, Exporter will export everything you select in the same way as a 'base' uSync export would. However, there are a few options you can add to the appsettings.json
file to change its behaviour.
{
"uSync": {
"Exporter": {
"Settings" :{
"Disabled": false,
"IncludeMedia": true,
"IncludeFiles": true,
"IncludeLinked": false,
"PageSize": 50,
"NoFolder": false,
"AdditionalFolders": "",
"Exclusions": "_ViewImports.cshtml",
"Replacements": "",
"HandlerSet": "Exporter"
}
}
}
}
Settings
Disabled
Don't allow sync packs to be imported onto this site.
IncludeMedia
Include Media files checkbox.
IncludeFiles
Include Files Checkbox.
IncludeLinked
Include items linked to selected items (e.g content linked to the selected content).
PageSize
Size of batches used when creating pack.
NoFolder
Turn off the import of site files & folders from sync packs (even if the sync pack has files/folders they will not be imported).
AdditionalFolders
Add extra folders to the list of folders used when creating/importing a sync pack. The default list is ~/views, ~/css, ~/scripts
.
Exclusions
Add additional RegEx values to the file exclusion list. The regex is applied to all files when exporting and importing. Anything that matches the regex will not be imported (or exported).
Default list: bin\\uSync, app_plugins\\uSync
Events
This feature requires uSync.Complete 8.9 or greater.
During an import of a sync pack, there are a number of events that you can use to hook into the the process whenever sync packs are created or imported.
Any of the core uSync events can be called from within uSync.Exporter if there are additional events.
Validating Sync Pack
This event is fired when a sync pack has been uploaded to the server and expanded, but before any actions are performed on the pack.
SyncPackService.ValidatingPack += ValidatePack
You can use this event to check the sync pack, and stop the importing of the pack if required.
private void ValidatingPack(uSyncPackEventArgs e)
{
// do you own checks.
// e.Request contains the info on the pack
// e.Request.Folder will contain the path
// to the expanded syncpack
// example cancellation.
e.Cancel = true;
e.CancellationMessage = "This sync pack doesn't not comply";
}