Exemple #1
0
        public IEnumerable <string> GetAllUnusedPhpSettingNames()
        {
            var allSettings     = PlacementRules.GetAllPHPSettingNames();
            var definedSettings = GetAllDefinedSettingNames().ToDictionary(v => v, v => true);

            foreach (var setting in allSettings)
            {
                if (!definedSettings.ContainsKey(setting))
                {
                    yield return(setting);
                }
            }
        }
Exemple #2
0
        private PHPIniSetting GetSetting(string settingName)
        {
            var settingChangable = PlacementRules.GetChangableLocation(settingName);

            foreach (var settingFileLocation in filesWhereSettingIsReadFrom[settingChangable])
            {
                var setting = _settings[settingFileLocation].GetSetting(settingName);
                if (setting == null)
                {
                    continue;
                }
                return(setting);
            }

            return(null);
        }
Exemple #3
0
        public bool SaveSetting(string settingName, string settingValue, string settingSection)
        {
            var setting = GetSetting(settingName);

            if (setting == null)
            {
                // The setting doesn't currently exist. Add a new setting
                setting = new PHPIniSetting()
                {
                    Name    = settingName,
                    Section = settingSection,
                };
            }
            else
            {
                if (String.Compare(setting.Value, settingValue) == 0)
                {
                    return(true);                                                  // No update needed
                }
            }

            setting.Value = settingValue;

            var settingChangableType = PlacementRules.GetChangableLocation(settingName);

            if (!filesWhereSettingIsReadFrom[settingChangableType].Contains(SettingLocation.UserIni))
            {
                //throw new InvalidOperationException("Can't set this");
                return(false);
            }

            // Save this setting to .user.ini file
            var phpFile = _settings[SettingLocation.UserIni];

            phpFile.AddOrUpdateSettings(new List <PHPIniSetting>()
            {
                setting
            });
            phpFile.Save();

            return(true);
        }
Exemple #4
0
        public bool IsSettingUpdatable(string name)
        {
            var loc = PlacementRules.GetChangableLocation(name);

            return(loc != ConfigLocation.PHP_INI_SYSTEM);
        }