예제 #1
0
        private void USyncService_ImportComplete(uSyncBulkEventArgs e)
        {
            if (!uSyncSettings.EnableHistory)
            {
                return;
            }

            var changes = e.Actions.Where(x => x.Change > ChangeType.NoChange);

            if (changes.Any())
            {
                var changeDetail = new SyncHistoryView
                {
                    Server   = HttpContext.Current?.Server?.MachineName ?? "Unknown",
                    Action   = "Import",
                    Username = GetUsername(),
                    When     = DateTime.Now,
                    Changes  = changes.ToList()
                };

                var actionString = JsonConvert.SerializeObject(changeDetail, Formatting.Indented);
                var filename     = $"History_{DateTime.Now:yyyyMMdd_HHmmss}.history";
                var path         = Path.Combine(historyFolder, DateTime.Now.ToString("yyyy"), DateTime.Now.ToString("MM"), filename);
                syncFileService.SaveFile(path, actionString);
            }
        }
예제 #2
0
        private void BulkEventComplete(uSyncBulkEventArgs e)
        {
            if (e.Actions.Any(x => x.Change > uSync8.Core.ChangeType.NoChange))
            {
                // change happened. - rebuild
                snapshotService.Rebuild();

                // then refresh the cache :

                // there is a function for this but it is internal, so we have extracted bits.
                // mimics => DistributedCache.RefreshAllPublishedSnapshot

                RefreshContentCache(Umbraco.Web.Composing.Current.DistributedCache);
                RefreshMediaCache(Umbraco.Web.Composing.Current.DistributedCache);
                RefreshAllDomainCache(Umbraco.Web.Composing.Current.DistributedCache);
            }
        }
        private void ImportComplete(uSyncBulkEventArgs e)
        {
            if (rebuildCacheOnCompleaton &&
                e.Actions.Any(x => x.Change > uSync8.Core.ChangeType.NoChange))
            {
                // change happened. - rebuild
                snapshotService.Rebuild();

                if (UmbracoVersion.LocalVersion.Major == 8 && UmbracoVersion.LocalVersion.Minor < 4)
                {
                    // we only do this on v8.3 and below.

                    // then refresh the cache :
                    // there is a function for this but it is internal, so we have extracted bits.
                    // mimics => DistributedCache.RefreshAllPublishedSnapshot
                    RefreshContentCache(Umbraco.Web.Composing.Current.DistributedCache);
                    RefreshMediaCache(Umbraco.Web.Composing.Current.DistributedCache);
                    RefreshAllDomainCache(Umbraco.Web.Composing.Current.DistributedCache);
                }
            }
        }
예제 #4
0
 private void OnBulkActionComplete(uSyncBulkEventArgs e)
 {
     entityCache.Clear();
 }