public void SimpleCompare(string database, string itemId)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Status = new List <Tuple <string, string> >();
                    var localItem = _sitecoreAccessService.GetLatestItemData(itemId, database);
                    if (localItem == null)
                    {
                        Status.Add(new Tuple <string, string>("cmmissing", "This content item only exists on the remote server."));
                        return;
                    }
                    var localChecksum = _checksumManager.GetChecksum(localItem.Id.ToString());
                    ChildChanged = localChecksum != -1 && Checksum != localChecksum;
                    CompareContentTreeNode local = new CompareContentTreeNode(localItem);
                    if (Revision != local.Revision)
                    {
                        Status.Add(new Tuple <string, string>("cmfieldchanged", "This content item exists on the local server, however the fields have different values."));
                    }
                    else
                    {
                        Status.Add(new Tuple <string, string>("cmequal", "This content item is equivalent on the source and target servers."));
                    }
                    if (ChildChanged)
                    {
                        Status.Add(new Tuple <string, string>("cmchildchanged", "There are changes in the children of this item."));
                    }
                    HashSet <string> tracker = new HashSet <string>();

                    foreach (ContentTreeNode child in Nodes)
                    {
                        tracker.Add(child.Id);
                    }

                    foreach (IItemData child in _sitecoreAccessService.GetChildren(localItem))
                    {
                        if (tracker.Contains(child.Id.ToString()))
                        {
                            continue;
                        }
                        var newnode = new CompareContentTreeNode(child, false)
                        {
                            Status = new List <Tuple <string, string> >
                            {
                                new Tuple <string, string>("cmextra", "This item only exists on the local server.")
                            },
                            MissingRemote = true
                        };
                        Nodes.Add(newnode);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error("Problem assembling diff for " + itemId, e, this);
            }
        }
Exemple #2
0
        public void SimpleCompare(string database, string itemId)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Status = new List <Tuple <string, string> >();
                    var localItem = Factory.GetDatabase(database, true).DataManager.DataEngine.GetItem(new ID(itemId), LanguageManager.DefaultLanguage, Sitecore.Data.Version.Latest);
                    if (localItem == null)
                    {
                        Status.Add(new Tuple <string, string>("cmmissing", "This content item only exists on the remote server."));
                        return;
                    }

                    ChildChanged = Checksum != ContentMigrationRegistration.GetChecksum(localItem.ID.ToString());
                    CompareContentTreeNode local = new CompareContentTreeNode(localItem);
                    if (Revision != local.Revision)
                    {
                        Status.Add(new Tuple <string, string>("cmfieldchanged", "This content item exists on the local server, however the fields have different values."));
                    }
                    else
                    {
                        Status.Add(new Tuple <string, string>("cmequal", "This content item is equivalent on the source and target servers."));
                    }
                    if (ChildChanged)
                    {
                        Status.Add(new Tuple <string, string>("cmchildchanged", "There are changes in the children of this item."));
                    }
                    HashSet <string> tracker = new HashSet <string>();

                    foreach (ContentTreeNode child in Nodes)
                    {
                        tracker.Add(child.Id);
                    }

                    foreach (Item child in localItem.Children)
                    {
                        if (tracker.Contains(child.ID.ToString()))
                        {
                            continue;
                        }
                        var newnode = new CompareContentTreeNode(child, false)
                        {
                            Status = new List <Tuple <string, string> >
                            {
                                new Tuple <string, string>("cmextra", "This item only exists on the local server.")
                            },
                            MissingRemote = true
                        };
                        Nodes.Add(newnode);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error("Problem assembling diff for " + itemId, e, this);
            }
        }