Inheritance: IRemoteObject
Exemplo n.º 1
0
        internal void Parse()
        {
            if (String.IsNullOrEmpty(FileName))
            {
                throw new InvalidOperationException();
            }

            string extensionDir = String.Empty;

            using (StreamReader reader = new StreamReader(FileName))
            {
                foreach (object o in PHPIniFile.ParseIniFile(reader))
                {
                    PHPIniSetting directive = o as PHPIniSetting;
                    if (directive != null)
                    {
                        Settings.Add(directive);
                        RawEntries.Add(directive);

                        // Get the path to the extension directory - this will be used later
                        if (String.Equals(directive.Name, "extension_dir", StringComparison.OrdinalIgnoreCase))
                        {
                            extensionDir = directive.GetTrimmedValue();
                        }
                    }
                    else
                    {
                        PHPIniExtension extension = o as PHPIniExtension;
                        if (extension != null)
                        {
                            Extensions.Add(extension);
                            RawEntries.Add(extension);
                        }
                        else
                        {
                            PHPIniBase entry = o as PHPIniBase;
                            if (entry != null)
                            {
                                RawEntries.Add(entry);
                            }
                        }
                    }
                }
            }

            if (String.IsNullOrEmpty(extensionDir) ||
                !Path.IsPathRooted(extensionDir))
            {
                extensionDir = Path.Combine(Path.GetDirectoryName(FileName), "ext");
            }

            if (Directory.Exists(extensionDir))
            {
                AddAllAvailableExtensions(extensionDir);
            }
        }
        protected override void BeginProcessing()
        {
            EnsureAdminUser();

            try
            {
                _serverManager = new ServerManager();
                ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(_serverManager, this.SiteName, this.VirtualPath);
                _configHelper = new PHPConfigHelper(serverManagerWrapper);
                _phpIniFile = _configHelper.GetPHPIniFile();
                _extensions = new RemoteObjectCollection<PHPIniExtension>();
            }
            catch (FileNotFoundException ex)
            {
                DisposeServerManager();
                ReportTerminatingError(ex, "FileNotFound", ErrorCategory.ObjectNotFound);
            }
            catch (InvalidOperationException ex)
            {
                DisposeServerManager();
                ReportTerminatingError(ex, "InvalidOperation", ErrorCategory.InvalidOperation);
            }
        }
Exemplo n.º 3
0
        private void OnGetSettingsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                object o = e.Result;

                _file = new PHPIniFile();
                _file.SetData(o);

                LoadPHPIni(_file);

                // If updated setting name was saved then use it to re-select it after refresh
                if (!String.IsNullOrEmpty(_updatedSettingName))
                {
                    SelectSettingByName(_updatedSettingName);
                    _updatedSettingName = null;
                }
            }
            catch (Exception ex)
            {
                DisplayErrorMessage(ex, Resources.ResourceManager);
            }
        }
Exemplo n.º 4
0
        private void UpdateUI(PHPIniFile file)
        {
            PHPIniSetting setting = file.GetSetting(SettingNames[0]);
            string[] settingValues = null;

            if (setting != null)
            {
                if (String.Equals(setting.TrimmedValue, SettingsDevValues[0]))
                {
                    _errorReportingPreset = ErrorReportingPreset.Development;
                    settingValues = SettingsDevValues;
                }
                else if (String.Equals(setting.TrimmedValue, SettingsProdValues[0]))
                {
                    _errorReportingPreset = ErrorReportingPreset.Production;
                    settingValues = SettingsProdValues;
                }

                int i = 1;
                while (_errorReportingPreset != ErrorReportingPreset.Undefined && i < SettingNames.Length)
                {
                    setting = file.GetSetting(SettingNames[i]);
                    if (setting == null || !String.Equals(setting.TrimmedValue, settingValues[i]))
                    {
                        _errorReportingPreset = ErrorReportingPreset.Undefined;
                    }
                    i = i + 1;
                }
            }

            if (_errorReportingPreset == ErrorReportingPreset.Development)
            {
                _devMachineRadioButton.Checked = true;
            }
            else if (_errorReportingPreset == ErrorReportingPreset.Production)
            {
                _prodMachineRadioButton.Checked = true;
            }

            setting = file.GetSetting("error_log");
            if (setting != null)
            {
                _errorLogFile = setting.TrimmedValue;
                _errorLogFileTextBox.Text = setting.TrimmedValue;
            }
        }
Exemplo n.º 5
0
        private static PHPIniSetting GetToApplyUploadTmpDir(PHPIniFile file)
        {
            PHPIniSetting setting = file.GetSetting("upload_tmp_dir");
            if (setting == null || !IsAbsoluteFilePath(setting.GetTrimmedValue(), false))
            {
                string value = Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\");
                setting = new PHPIniSetting("upload_tmp_dir", DoubleQuotesWrap(value), "PHP");
            }

            return setting;
        }
Exemplo n.º 6
0
        public void AddOrUpdatePHPIniSettings(IEnumerable<PHPIniSetting> settings)
        {
            EnsurePHPIsRegistered();

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            file.AddOrUpdateSettings(settings);
            file.Save(file.FileName);
        }
Exemplo n.º 7
0
        public PHPIniFile GetPHPIniFile()
        {
            EnsurePHPIsRegistered();

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            return file;
        }
Exemplo n.º 8
0
        private PHPIniSetting GetToApplyErrorLog(PHPIniFile file)
        {
            var handlerName = _currentPhpHandler.Name;
            var setting = file.GetSetting("error_log");
            if (setting == null || !IsAbsoluteFilePath(setting.GetTrimmedValue(), true))
            {
                var value = Path.Combine(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\"), handlerName + "_errors.log");
                setting = new PHPIniSetting("error_log", DoubleQuotesWrap(value), "PHP");
            }

            return setting;
        }
Exemplo n.º 9
0
        public void UpdateExtensions(IEnumerable<PHPIniExtension> extensions)
        {
            EnsurePHPIsRegistered();

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            file.UpdateExtensions(extensions);
            file.Save(file.FileName);
        }
Exemplo n.º 10
0
        private static PHPConfigIssue ValidateUploadTmpDir(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;
            // Check if Upload dir is set to an absolute path and that path exists
            var setting = file.GetSetting("upload_tmp_dir");
            var expectedValue = Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\");
            if (setting == null || String.IsNullOrEmpty(setting.GetTrimmedValue()))
            {
                configIssue = new PHPConfigIssue("upload_tmp_dir",
                                                                String.Empty,
                                                                expectedValue,
                                                                "ConfigIssueUploadDirNotSet",
                                                                "ConfigIssueUploadDirRecommend",
                                                                PHPConfigIssueIndex.UploadDir);
            }
            else if (!IsAbsoluteFilePath(setting.GetTrimmedValue(), false /* this is supposed to be a directory */))
            {
                configIssue = new PHPConfigIssue("upload_tmp_dir",
                                                                setting.GetTrimmedValue(),
                                                                expectedValue,
                                                                "ConfigIssueUploadDirNotCorrect",
                                                                "ConfigIssueUploadDirRecommend",
                                                                PHPConfigIssueIndex.UploadDir);
            }

            return configIssue;
        }
Exemplo n.º 11
0
        private void OnGetExtensionsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                object o = e.Result;

                _file = new PHPIniFile();
                _file.SetData(o);

                LoadExtensions(_file);

                // If name of the updated extension was saved then use it to re-select it.
                if (!String.IsNullOrEmpty(_updatedExtensionName))
                {
                    SelectExtensionByName(_updatedExtensionName);
                    _updatedExtensionName = null;
                }
            }
            catch (Exception ex)
            {
                DisplayErrorMessage(ex, Resources.ResourceManager);
            }
        }
Exemplo n.º 12
0
        public void RemovePHPIniSetting(PHPIniSetting setting)
        {
            EnsurePHPIsRegistered();

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            if (file.Remove(setting))
            {
                file.Save(file.FileName);
            }
        }
Exemplo n.º 13
0
        private void LoadExtensions(PHPIniFile file)
        {
            try
            {
                ListView.SuspendLayout();
                ListView.Items.Clear();

                foreach (PHPIniExtension extension in file.Extensions)
                {
                    if (_filterBy != null && _filterValue != null) {
                        if (_filterBy == NameString &&
                            extension.Name.IndexOf(_filterValue, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            continue;
                        }
                    }
                    ListView.Items.Add(new PHPExtensionItem(extension));
                }

                if (SelectedGrouping != null)
                {
                    Group(SelectedGrouping);
                }
            }
            finally
            {
                ListView.ResumeLayout();
            }
        }
Exemplo n.º 14
0
        protected override PropertyBag GetProperties()
        {
            PropertyBag result = new PropertyBag();

            object o = Module.Proxy.GetPHPIniSettings();
            PHPIniFile file = new PHPIniFile();
            file.SetData(o);

            for (int i = 0; i < _settingNames.Length; i++)
            {
                PHPIniSetting setting = file.GetSetting(_settingNames[i]);
                if (setting != null)
                {
                    result[i] = setting.Value;
                }
            }
           
            return result;
        }
Exemplo n.º 15
0
 private static PHPIniFile LoadPhpFile(string phpFilePath)
 {
     if (phpFilePath == null) throw new InvalidOperationException();
     var phpFile = new PHPIniFile(phpFilePath);
     return phpFile;
 }
Exemplo n.º 16
0
        private void ApplyRecommendedPHPIniSettings(ArrayList configIssueIndexes)
        {
            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            var settings = new List<PHPIniSetting>();

            foreach (int configIssueIndex in configIssueIndexes)
            {
                switch (configIssueIndex)
                {
                    case PHPConfigIssueIndex.ExtensionDir:
                        {
                            settings.Add(GetToApplyExtensionDir());
                            break;
                        }
                    case PHPConfigIssueIndex.LogErrors:
                        {
                            settings.Add(GetToApplyLogErrors());
                            break;
                        }
                    case PHPConfigIssueIndex.ErrorLog:
                        {
                            settings.Add(GetToApplyErrorLog(file));
                            break;
                        }
                    case PHPConfigIssueIndex.SessionPath:
                        {
                            settings.Add(GetToApplySessionPath(file));
                            break;
                        }
                    case PHPConfigIssueIndex.UploadDir:
                        {
                            settings.Add(GetToApplyUploadTmpDir(file));
                            break;
                        }
                    case PHPConfigIssueIndex.CgiForceRedirect:
                        {
                            settings.Add(GetToApplyCgiForceRedirect());
                            break;
                        }
                    case PHPConfigIssueIndex.CgiPathInfo:
                        {
                            settings.Add(GetToApplyCgiPathInfo());
                            break;
                        }
                    case PHPConfigIssueIndex.FastCgiImpersonation:
                        {
                            settings.Add(GetToApplyFastCgiImpersonate());
                            break;
                        }
                    case PHPConfigIssueIndex.DateTimeZone:
                        {
                            settings.Add(GetToApplyDateTimeZone(file));
                            break;
                        }
                }
            }

            if (settings.Count > 0)
            {
                file.AddOrUpdateSettings(settings);
                file.Save(PHPIniFilePath);
            }
        }
Exemplo n.º 17
0
        private static PHPConfigIssue ValidateCgiPathInfo(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;
            
            // Check if cgi.fix_pathinfo is set correctly
            var setting = file.GetSetting("cgi.fix_pathinfo");
            if (setting == null || String.IsNullOrEmpty(setting.GetTrimmedValue()))
            {
                configIssue = new PHPConfigIssue("cgi.fix_pathinfo",
                                                                String.Empty,
                                                                "1",
                                                                "ConfigIssueCgiPathInfoNotSet",
                                                                "ConfigIssueCgiPathInfoRecommend",
                                                                PHPConfigIssueIndex.CgiPathInfo);
            }
            else if (!String.Equals(setting.GetTrimmedValue(), "1", StringComparison.OrdinalIgnoreCase))
            {
                configIssue = new PHPConfigIssue("cgi.fix_pathinfo",
                                                                setting.GetTrimmedValue(),
                                                                "1",
                                                                "ConfigIssueCgiPathInfoNotCorrect",
                                                                "ConfigIssueCgiPathInfoRecommend",
                                                                PHPConfigIssueIndex.CgiPathInfo);
            }

            return configIssue;
        }
Exemplo n.º 18
0
        private static PHPConfigIssue ValidateLogErrors(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;

            // Check if log_errors is set to On
            var setting = file.GetSetting("log_errors");
            if (setting == null || String.IsNullOrEmpty(setting.GetTrimmedValue()))
            {
                configIssue = new PHPConfigIssue("log_errors",
                                                                String.Empty,
                                                                "On",
                                                                "ConfigIssueLogErrorsNotSet",
                                                                "ConfigIssueLogErrorsRecommend",
                                                                PHPConfigIssueIndex.LogErrors);
            }
            else if (!String.Equals(setting.GetTrimmedValue(), "On", StringComparison.OrdinalIgnoreCase))
            {
                configIssue = new PHPConfigIssue("log_errors",
                                                                setting.GetTrimmedValue(),
                                                                "On",
                                                                "ConfigIssueLogErrorsNotCorrect",
                                                                "ConfigIssueLogErrorsRecommend",
                                                                PHPConfigIssueIndex.LogErrors);
            }

            return configIssue;
        }
Exemplo n.º 19
0
        public RemoteObjectCollection<PHPConfigIssue> ValidateConfiguration()
        {
            EnsurePHPIsRegistered();

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            return ValidateConfiguration(file);
        }
Exemplo n.º 20
0
        public PHPConfigInfo GetPHPConfigInfo()
        {
            var configInfo = new PHPConfigInfo();

            // If PHP is not registered properly then just return information about
            // how it registered.
            if (!IsPHPRegistered())
            {
                configInfo.RegistrationType = _registrationType;
                return configInfo;
            }

            configInfo.RegistrationType = _registrationType;
            configInfo.HandlerName = _currentPhpHandler.Name;
            configInfo.HandlerIsLocal = _currentPhpHandler.IsLocallyStored;
            configInfo.Executable = _currentPhpHandler.Executable;
            configInfo.Version = GetPHPExecutableVersion(_currentPhpHandler.Executable);
            configInfo.PHPIniFilePath = PHPIniFilePath;

            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            var setting = file.GetSetting("error_log");
            configInfo.ErrorLog = setting != null ? setting.GetTrimmedValue() : String.Empty;

            configInfo.EnabledExtCount = file.GetEnabledExtensionsCount();
            configInfo.InstalledExtCount = file.Extensions.Count;

            ICollection issues = ValidateConfiguration(file);
            configInfo.IsConfigOptimal = (issues.Count == 0);

            return configInfo;
        }
Exemplo n.º 21
0
        private RemoteObjectCollection<PHPConfigIssue> ValidateConfiguration(PHPIniFile file)
        {

            var configIssues = new RemoteObjectCollection<PHPConfigIssue>();
          
            // IIS and FastCGI settings
            var configIssue = ValidateDefaultDocument();
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }
            
            configIssue = ValidateResourceType();
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidatePHPMaxRequests();
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidatePHPRC();
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateMonitorChanges();
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            // PHP Settings
            configIssue = ValidateExtensionDir(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateLogErrors(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateErrorLog(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateSessionPath(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateUploadTmpDir(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateCgiForceRedirect(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateCgiPathInfo(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateFastCgiImpersonate(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            configIssue = ValidateDateTimeZone(file);
            if (configIssue != null)
            {
                configIssues.Add(configIssue);
            }

            return configIssues;
        }
Exemplo n.º 22
0
        private static PHPIniSetting GetToApplyDateTimeZone(PHPIniFile file)
        {
            var setting = file.GetSetting("date.timezone") ?? new PHPIniSetting("date.timezone", DoubleQuotesWrap(GetPHPTimeZone()), "Date");

            return setting;
        }
Exemplo n.º 23
0
        private static PHPConfigIssue ValidateDateTimeZone(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;

            var setting = file.GetSetting("date.timezone");
            if (setting == null)
            {
                configIssue = new PHPConfigIssue("date.timezone",
                                                               String.Empty,
                                                               GetPHPTimeZone(),
                                                               "ConfigIssueDateTimeZoneNotSet",
                                                               "ConfigIssueDateTimeZoneRecommend",
                                                               PHPConfigIssueIndex.DateTimeZone);
            }

            return configIssue;
        }
Exemplo n.º 24
0
 private static PHPIniSetting GetToApplySessionPath(PHPIniFile file)
 {
     PHPIniSetting setting = file.GetSetting("session.save_path");
     if (setting == null || !IsAbsoluteFilePath(setting.GetTrimmedValue(), false))
     {
         string value = Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\");
         setting = new PHPIniSetting("session.save_path", DoubleQuotesWrap(value), "Session");
     }
     
     return setting;
 }
Exemplo n.º 25
0
        private PHPConfigIssue ValidateErrorLog(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;

            // Check if error_log is set to an absolute path and that path exists
            var setting = file.GetSetting("error_log");
            string expectedValue = Path.Combine(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Temp\"), _currentPhpHandler.Name + "_errors.log");
            if (setting == null || String.IsNullOrEmpty(setting.GetTrimmedValue()))
            {
                configIssue = new PHPConfigIssue("error_log",
                                                                String.Empty,
                                                                expectedValue,
                                                                "ConfigIssueErrorLogNotSet",
                                                                "ConfigIssueErrorLogRecommend",
                                                                PHPConfigIssueIndex.ErrorLog);
            }
            else if (!IsAbsoluteFilePath(setting.GetTrimmedValue(), true /* this is supposed to be a file */))
            {
                configIssue = new PHPConfigIssue("error_log",
                                                                setting.GetTrimmedValue(),
                                                                expectedValue,
                                                                "ConfigIssueErrorLogNotCorrect",
                                                                "ConfigIssueErrorLogRecommend",
                                                                PHPConfigIssueIndex.ErrorLog);
            }

            return configIssue;
        }
Exemplo n.º 26
0
        private void MakeRecommendedPHPIniChanges()
        {
            var file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            // Set the recommended php.ini settings
            var settings = new List<PHPIniSetting>
                {
                    GetToApplyExtensionDir(),
                    GetToApplyLogErrors(),
                    GetToApplyErrorLog(file),
                    GetToApplySessionPath(file),
                    GetToApplyUploadTmpDir(file),
                    GetToApplyDateTimeZone(file),
                    GetToApplyCgiForceRedirect(),
                    GetToApplyCgiPathInfo(),
                    GetToApplyFastCgiImpersonate(),
                    new PHPIniSetting("fastcgi.logging", "0", "PHP"),
                    new PHPIniSetting("max_execution_time", "300", "PHP"),
                    new PHPIniSetting("display_errors", "Off", "PHP")
                };

            // Enable the most common PHP extensions
            var extensions = new List<PHPIniExtension>
                {
                    new PHPIniExtension("php_curl.dll", true),
                    new PHPIniExtension("php_gd2.dll", true),
                    new PHPIniExtension("php_gettext.dll", true),
                    new PHPIniExtension("php_mysql.dll", true),
                    new PHPIniExtension("php_mysqli.dll", true),
                    new PHPIniExtension("php_mbstring.dll", true),
                    new PHPIniExtension("php_openssl.dll", true),
                    new PHPIniExtension("php_soap.dll", true),
                    new PHPIniExtension("php_xmlrpc.dll", true)
                };

            file.UpdateExtensions(extensions);
            file.AddOrUpdateSettings(settings);
            file.Save(PHPIniFilePath);
        }
Exemplo n.º 27
0
        public RemoteObjectCollection<PHPConfigIssue> ValidateConfiguration()
        {
            // Check if PHP is not registered
            if (!IsPHPRegistered())
            {
                return null;
            }

            PHPIniFile file = new PHPIniFile(PHPIniFilePath);
            file.Parse();

            return ValidateConfiguration(file);
        }
Exemplo n.º 28
0
        private void LoadPHPIni(PHPIniFile file)
        {
            try
            {
                ListView.SuspendLayout();
                ListView.Items.Clear();

                foreach (PHPIniSetting setting in file.Settings)
                {
                    if (_filterBy != null && _filterValue != null) {
                        if (_filterBy == NameString &&
                            setting.Name.IndexOf(_filterValue, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            continue;
                        }
                        else if (_filterBy == ValueString &&
                            setting.Value.IndexOf(_filterValue, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            continue;
                        }
                        else if (_filterBy == SectionString &&
                            setting.Section.IndexOf(_filterValue, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            continue;
                        }
                    }
                   
                    ListView.Items.Add(new PHPSettingItem(setting));
                }

                if (SelectedGrouping != null)
                {
                    Group(SelectedGrouping);
                }
            }
            finally
            {
                ListView.ResumeLayout();
            }
        }
Exemplo n.º 29
0
        private static PHPConfigIssue ValidateFastCgiImpersonate(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;
            
            // Check if fastcgi impersonation is turned on
            var setting = file.GetSetting("fastcgi.impersonate");
            if (setting == null || String.IsNullOrEmpty(setting.GetTrimmedValue()))
            {
                configIssue = new PHPConfigIssue("fastcgi.impersonate",
                                                                String.Empty,
                                                                "1",
                                                                "ConfigIssueFastCgiImpersonateNotSet",
                                                                "ConfigIssueFastCgiImpersonateRecommend",
                                                                PHPConfigIssueIndex.FastCgiImpersonation);
            }
            else if (!String.Equals(setting.GetTrimmedValue(), "1", StringComparison.OrdinalIgnoreCase))
            {
                configIssue = new PHPConfigIssue("fastcgi.impersonate",
                                                                setting.GetTrimmedValue(),
                                                                "1",
                                                                "ConfigIssueFastCgiImpersonateNotCorrect",
                                                                "ConfigIssueFastCgiImpersonateRecommend",
                                                                PHPConfigIssueIndex.FastCgiImpersonation);
            }

            return configIssue;
        }
Exemplo n.º 30
0
        private PHPConfigIssue ValidateExtensionDir(PHPIniFile file)
        {
            PHPConfigIssue configIssue = null;
            
            var setting = file.GetSetting("extension_dir");
            string expectedValue = EnsureTrailingBackslash(Path.Combine(PHPDirectory, "ext"));
            if (setting == null || String.IsNullOrEmpty(setting.GetTrimmedValue()))
            {
                configIssue = new PHPConfigIssue("extension_dir",
                                                                String.Empty,
                                                                expectedValue,
                                                                "ConfigIssueExtensionDirNotSet",
                                                                "ConfigIssueExtensionDirRecommend",
                                                                PHPConfigIssueIndex.ExtensionDir);
            }
            else
            {
                string currentValue = EnsureTrailingBackslash(setting.GetTrimmedValue());
                currentValue = EnsureBackslashes(currentValue);
                if (!String.Equals(currentValue, expectedValue, StringComparison.OrdinalIgnoreCase))
                {
                    configIssue = new PHPConfigIssue("extension_dir",
                                                                    setting.GetTrimmedValue(),
                                                                    expectedValue,
                                                                    "ConfigIssueExtensionDirIncorrect",
                                                                    "ConfigIssueExtensionDirRecommend",
                                                                    PHPConfigIssueIndex.ExtensionDir);
                }
            }

            return configIssue;
        }
Exemplo n.º 31
0
        private void OnGetSettingsCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                object o = e.Result;

                PHPIniFile file = new PHPIniFile();
                file.SetData(o);

                UpdateUI(file);
            }
            catch (Exception ex)
            {
                DisplayErrorMessage(ex, Resources.ResourceManager);
            }
        }