Exemplo n.º 1
0
        /// <inheritdoc/>
        public string SynchronizeStagingTask(IServer server)
        {
            string res = string.Empty;

            // Gets a staging server
            ServerInfo stagingServer = this.GetServer(server.ServerName, server.ServerSiteID).UndoActLike();

            if (stagingServer != null)
            {
                // Gets all staging tasks that target the given server
                var tasks = StagingTaskInfoProvider.SelectTaskList(stagingServer.ServerSiteID, stagingServer.ServerID, null, null);

                if (tasks.Count == 0)
                {
                    return("There is no task that target the given server.");
                }

                // Loops through individual staging tasks
                foreach (StagingTaskInfo task in tasks)
                {
                    // Synchronizes the staging task
                    string result = new StagingTaskRunner(stagingServer.ServerID).RunSynchronization(task.TaskID);

                    // The task synchronization failed
                    // The 'result' string returned by the RunSynchronization method contains the error message for the given task
                    if (!string.IsNullOrEmpty(result))
                    {
                        res += result + "\n";
                    }
                }
            }

            return(res);
        }
Exemplo n.º 2
0
    private string SynchronizeSelectedInternal(IEnumerable <string> list)
    {
        AddLog(GetString("Synchronization.RunningTasks"));

        // Run the synchronization
        return(StagingTaskRunner.RunSynchronization(list));
    }
Exemplo n.º 3
0
    private string SynchronizeCurrentInternal()
    {
        int sid = SelectedServerID;

        if (sid <= 0)
        {
            sid = SynchronizationInfoProvider.ENABLED_SERVERS;
        }

        string result = null;

        // Process all types
        string[] syncTypes = objectType.Split(';');
        foreach (string syncType in syncTypes)
        {
            if (syncType != string.Empty)
            {
                AddLog(String.Format(GetString("Synchronization.LoggingTasks"), syncType));

                // Create update tasks
                SynchronizationHelper.LogObjectChange(syncType, synchronizedSiteId, DateTimeHelper.ZERO_TIME, TaskTypeEnum.UpdateObject, true, false, false, false, false, CurrentSiteID, sid);

                AddLog(GetString("Synchronization.RunningTasks"));

                // Get the tasks
                string where = GetSiteWhere();
                DataSet ds = StagingTaskInfoProvider.SelectObjectTaskList(CurrentSiteID, SelectedServerID, syncType, @where, "TaskID", -1, "TaskID");

                // Run the synchronization
                result += StagingTaskRunner.RunSynchronization(ds);
            }
        }

        return(result);
    }
Exemplo n.º 4
0
    private string SynchronizeAllInternal()
    {
        AddLog(GetString("Synchronization.RunningTasks"));

        // Get the tasks
        DataSet ds = StagingTaskInfoProvider.SelectTaskList(CurrentSiteID, SelectedServerID, GridTasks.CustomFilter.WhereCondition, "TaskID", -1, "TaskID");

        // Run the synchronization
        return(StagingTaskRunner.RunSynchronization(ds));
    }
    private string SynchronizeAllInternal()
    {
        EventCode = "SYNCALLDOCS";

        AddLog(GetString("Synchronization.RunningTasks"));

        // Process all records
        DataSet ds = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, aliasPath, tasksUniGrid.CustomFilter.WhereCondition, "TaskID", -1, "TaskID");

        // Run the synchronization
        return(StagingTaskRunner.RunSynchronization(ds));
    }
    private string CreateUpdateTasksAndRunTasksInternal(string action)
    {
        string result;
        int    sid = SelectedServerID;

        if (sid <= 0)
        {
            sid = SynchronizationInfoProvider.ENABLED_SERVERS;
        }

        EventCode = "SYNCHRONIZE";

        AddLog(String.Format(GetString("Synchronization.LoggingTasks"), PredefinedObjectType.DOCUMENT));

        // Prepare settings for current node
        var settings = new LogMultipleDocumentChangeSettings
        {
            EnsurePublishTask = true,
            NodeAliasPath     = aliasPath,
            TaskType          = TaskTypeEnum.UpdateDocument,
            ServerID          = sid,
            KeepTaskData      = false,
            RunAsynchronously = false,
            SiteName          = CurrentSiteName
        };

        // Create update task for current node
        var currentNodeUpdateTask = DocumentSynchronizationHelper.LogDocumentChange(settings);

        // Create update tasks for subtree or for the whole tree, depends on sync action
        if (action != SYNCHRONIZE_CURRENT)
        {
            settings.NodeAliasPath = action == SYNCHRONIZE_COMPLETE ? "/%" : aliasPath.TrimEnd('/') + "/%";
            DocumentSynchronizationHelper.LogDocumentChange(settings);
        }

        AddLog(GetString("Synchronization.RunningTasks"));

        if (action == SYNCHRONIZE_CURRENT)
        {
            // Run sync for the current node only
            result = StagingTaskRunner.RunSynchronization(currentNodeUpdateTask.Select(t => t.TaskID));
        }
        else
        {
            // Get all tasks for given path, depends on the sync action and run them
            string  path = action == SYNCHRONIZE_COMPLETE ? "/" : aliasPath;
            DataSet ds   = StagingTaskInfoProvider.SelectDocumentTaskList(CurrentSiteID, SelectedServerID, path, null, "TaskID", -1, "TaskID");
            result = StagingTaskRunner.RunSynchronization(ds);
        }
        return(result);
    }
Exemplo n.º 7
0
    private string SynchronizeAllInternal()
    {
        AddLog(GetString("Synchronization.RunningTasks"));

        // Get the tasks
        string where = new WhereCondition()
                       .Where(GetSiteWhere())
                       .And()
                       .Where(gridTasks.CustomFilter.WhereCondition)
                       .ToString(true);

        DataSet ds = StagingTaskInfoProvider.SelectObjectTaskList(CurrentSiteID, SelectedServerID, objectType, @where, "TaskID", -1, "TaskID");

        // Run the synchronization
        return(StagingTaskRunner.RunSynchronization(ds));
    }
Exemplo n.º 8
0
    private string SynchronizeCurrentInternal()
    {
        int sid = SelectedServerID;

        if (sid <= 0)
        {
            sid = SynchronizationInfoProvider.ENABLED_SERVERS;
        }

        string result = null;

        // Process all types
        string[] syncTypes = objectType.Split(';');
        foreach (string syncType in syncTypes)
        {
            if (syncType != string.Empty)
            {
                AddLog(String.Format(GetString("Synchronization.LoggingTasks"), syncType));

                // Scheduled tasks have disabled staging, they have to be dealt in extra manner
                if (syncType.Equals(TaskInfo.OBJECT_TYPE, StringComparison.InvariantCultureIgnoreCase))
                {
                    CreateStagingTasksForScheduledTasks(synchronizedSiteId, CurrentSiteID);
                }
                else
                {
                    // Create update tasks
                    SynchronizationHelper.LogObjectChange(syncType, synchronizedSiteId, DateTimeHelper.ZERO_TIME, TaskTypeEnum.UpdateObject, true, false, false, false, false, CurrentSiteID, sid);
                }

                AddLog(GetString("Synchronization.RunningTasks"));

                // Get the tasks
                string where = GetSiteWhere();
                DataSet ds = StagingTaskInfoProvider.SelectObjectTaskList(CurrentSiteID, SelectedServerID, syncType, @where, "TaskID", -1, "TaskID");

                // Run the synchronization
                result += StagingTaskRunner.RunSynchronization(ds);
            }
        }

        return(result);
    }
Exemplo n.º 9
0
    private string SynchronizeCurrentInternal()
    {
        int sid = SelectedServerID;

        if (sid <= 0)
        {
            sid = SynchronizationInfoProvider.ENABLED_SERVERS;
        }

        AddLog(String.Format(GetString("Synchronization.LoggingTasks"), objectType));

        // Create update tasks
        SynchronizationHelper.LogObjectChange(objectType, 0, DateTimeHelper.ZERO_TIME, TaskTypeEnum.UpdateObject, true, false, false, false, false, CurrentSiteID, sid);

        AddLog(GetString("Synchronization.RunningTasks"));

        // Get the tasks
        DataSet ds = GetStagingDataTasks();

        // Run the synchronization
        return(StagingTaskRunner.RunSynchronization(ds));
    }