Ejemplo n.º 1
0
        public ActionResult RemoteConfigPostSync(int id)
        {
            _orchardServices.WorkContext.HttpContext.Server.ScriptTimeout = 600;

            var result = _contentSyncService.Sync(id);

            switch (result.Status)
            {
            case ContentSyncResultStatus.RemoteSiteConfigDoesNotExist:
                _orchardServices.Notifier.Warning(T("The site details you attempted to sync with no longer exist."));
                break;

            case ContentSyncResultStatus.RemoteUrlTimedout:
                _orchardServices.Notifier.Error(T("There was an unexpected error when trying to export the remote site. The remote site was not accessible."));
                break;

            case ContentSyncResultStatus.RemoteUrlUnauthorized:
                _orchardServices.Notifier.Warning(T("Either the username and password you supplied is incorrect, or this user does not have the correct permissions to export content."));
                break;

            case ContentSyncResultStatus.RemoteUrlFailed:
                _orchardServices.Notifier.Warning(T("The remote site failed to return an export of its content."));
                break;

            case ContentSyncResultStatus.RecipeExecutionPending:
                _orchardServices.Notifier.Information(T("The remote site's content export has been downloaded and is now in the process of being imported."));
                break;

            case ContentSyncResultStatus.RecipeExecutionFailed:
                _orchardServices.Notifier.Error(T("The remote site's content export has been downloaded, but there was an error when trying to import the content."));
                return(RedirectToAction("ImportResult", "Admin", new { ExecutionId = result.RecipeExecutionId, area = "Orchard.ImportExport" }));

            case ContentSyncResultStatus.OK:
                _orchardServices.Notifier.Information(T("Site content has been synced."));
                break;
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public void RemoteSyncWithCredentials()
        {
            var result = _contentSyncService.Sync(Url, Username, Password);

            Context.Output.WriteLine(T("Content Sync finished with status {0}", result.Status));
        }