Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void Save(NodeSaveSettings settings)
        {
            AssertSettings();

            if (_dynamicFieldsChanged && BinaryAsJObject != null)
            {
                // If this is a JSON settings file and the dynamic metadata changed, save the JSON binary according to the changes
                JsonDynamicFieldHelper.SaveToStream(BinaryAsJObject, stream =>
                {
                    this.Binary.SetStream(stream);
                    base.Save(settings);
                    _dynamicFieldsChanged = false;
                });
            }
            else
            {
                base.Save(settings);
            }

            // Find all settings that inherit from this setting and remove their cached data

            if (RepositoryInstance.LuceneManagerIsRunning && !RepositoryEnvironment.WorkingMode.Importing)
            {
                string contextPath = null;

                if (this.ParentPath.StartsWith(SETTINGSCONTAINERPATH, true, System.Globalization.CultureInfo.InvariantCulture))
                {
                    contextPath = "/Root";
                }
                else
                {
                    contextPath = GetParentContextPath(this.Path);
                }
                if (contextPath == null)
                {
                    using (new SystemAccount())
                    {
                        var q = ContentQuery.Query(SafeQueries.InTreeAndTypeIsAndName,
                                                   new QuerySettings {
                            EnableAutofilters = FilterStatus.Disabled
                        },
                                                   contextPath, typeof(Settings).Name, this.Name);
                        foreach (var id in q.Identifiers)
                        {
                            NodeIdDependency.FireChanged(id);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void Save(NodeSaveSettings settings)
 {
     if (_dynamicFieldsChanged)
     {
         JsonDynamicFieldHelper.SaveToStream(_jObject, stream =>
         {
             this.Binary.SetStream(stream);
             base.Save(settings);
             _dynamicFieldsChanged = false;
         });
     }
     else
     {
         base.Save(settings);
     }
 }