Example #1
0
 internal PHPConfigInfo GetPHPConfigInfo()
 {
     object o = Invoke("GetPHPConfigInfo");
     PHPConfigInfo result = null;
     if (o != null)
     {
         result = new PHPConfigInfo();
         result.SetData(o);
     }            
     return result;
 }
Example #2
0
        private void UpdatePHPSetupItem(PHPConfigInfo configInfo)
        {
            bool isPHPSetup = (configInfo != null && configInfo.RegistrationType == PHPRegistrationType.FastCgi);

            _phpSetupItem.SetTitleState(isPHPSetup);
            _phpSetupItem.ClearWarning();

            if (isPHPSetup)
            {
                // Show warning about non optimal configuration if
                // PHP configuration is not optimal and
                // user is a server administrator.
                if (!configInfo.IsConfigOptimal && Connection.IsUserServerAdministrator)
                {
                    _phpSetupItem.SetWarning(PreparePHPConfigWarning());
                }
            }
            else if (configInfo != null)
            {
                // Show warning about PHP not being setup or setup incorrectly
                _phpSetupItem.SetWarning(PreparePHPRegistrationWarning(configInfo.RegistrationType));
            }
            else
            {
                // Show warning about failed IIS configuration
                Label errorLabel = new Label();
                errorLabel.Text = Resources.ErrorFailedToGetConfiguration;
                _phpSetupItem.SetWarning(errorLabel);
            }
            _versionValueLabel.Text = isPHPSetup ? configInfo.Version : Resources.PHPPagePHPNotAvailable;
            _executableValueLabel.Text = isPHPSetup ? configInfo.Executable : Resources.PHPPagePHPNotAvailable;
            _handlerMappingValueLabel.Text = isPHPSetup ? GetHandlerMappingLabelText(configInfo.HandlerIsLocal) : Resources.PHPPagePHPNotAvailable;

            // Allow PHP registration only for server administrators
            if (configInfo != null && configInfo.RegistrationType != PHPRegistrationType.NoneNoFastCgi)
            {
                _phpSetupItem.SetTaskState(IndexRegisterPHPTask, Connection.IsUserServerAdministrator);
            }
            else
            {
                // If there is an error in IIS configuration then do not allow new registrations
                _phpSetupItem.SetTaskState(IndexRegisterPHPTask, false);
            }

            _phpSetupItem.SetTaskState(IndexChangeVersionTask, isPHPSetup);
            _phpSetupItem.SetTaskState(IndexCheckPHPInfoTask, isPHPSetup);
        }
Example #3
0
        private void UpdatePHPSettingsItem(PHPConfigInfo configInfo)
        {
            bool isPHPSetup = (configInfo != null && configInfo.RegistrationType == PHPRegistrationType.FastCgi);

            _phpSettingsItem.SetTitleState(isPHPSetup);
            if (isPHPSetup)
            {
                PrepareOpenFileLink(_configPathValueLabel, configInfo.PHPIniFilePath, Connection.IsLocalConnection);
                PrepareOpenFileLink(_errorLogValueLabel, configInfo.ErrorLog, Connection.IsLocalConnection);
            }
            else
            {
                PrepareOpenFileLink(_configPathValueLabel, Resources.PHPPagePHPNotAvailable, false);
                PrepareOpenFileLink(_errorLogValueLabel, Resources.PHPPagePHPNotAvailable, false);
            }
            _phpSettingsItem.SetTaskState(IndexErrorReportingTask, isPHPSetup);
            _phpSettingsItem.SetTaskState(IndexLimitsTask, isPHPSetup);
            _phpSettingsItem.SetTaskState(IndexAllSettingsTask, isPHPSetup);
        }
Example #4
0
        private void UpdatePHPExtensionsItem(PHPConfigInfo configInfo)
        {
            bool isPHPSetup = (configInfo != null && configInfo.RegistrationType == PHPRegistrationType.FastCgi);

            _phpExtensionItem.SetTitleState(isPHPSetup);
            if (isPHPSetup)
            {
                _enabledExtLabel.Text = String.Format(CultureInfo.CurrentCulture, Resources.PHPPageEnabledExtensions, configInfo.EnabledExtCount);
                _installedExtLabel.Text = String.Format(CultureInfo.CurrentCulture, Resources.PHPPageInstalledExtensions, configInfo.InstalledExtCount);
            }
            else
            {
                _enabledExtLabel.Text = Resources.PHPPageExtensionsNotAvailable;
                _installedExtLabel.Text = Resources.PHPPageExtensionsNotAvailable;
            }
            _phpExtensionItem.SetTaskState(IndexAllExtensionsTask, isPHPSetup);

            if (Connection.IsUserServerAdministrator)
            {
                _phpExtensionItem.SetTaskState(IndexAddExtensionTask, isPHPSetup);
            }
        }
Example #5
0
        private void UpdatePageItemsState(PHPConfigInfo configInfo)
        {
            UpdatePHPSetupItem(configInfo);
            UpdatePHPSettingsItem(configInfo);
            UpdatePHPExtensionsItem(configInfo);

            PerformLayout();
        }
 public PHPConfigurationItem(PHPConfigInfo configInfo)
 {
     _configInfo = configInfo;
 }
        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;
        }
        public PHPConfigInfo GetPHPConfigInfo()
        {
            PHPConfigInfo 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.Executable = _currentPHPHandler.Executable;
            configInfo.Version = GetPHPExecutableVersion(_currentPHPHandler.Executable);

            if (String.IsNullOrEmpty(PHPIniFilePath))
            {
                throw new FileNotFoundException("php.ini file does not exist");
            }

            configInfo.PHPIniFilePath = PHPIniFilePath;

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

            PHPIniSetting setting = file.GetSetting("error_log");
            if (setting != null)
            {
                configInfo.ErrorLog = setting.TrimmedValue;
            }
            else
            {
                configInfo.ErrorLog = String.Empty;
            }

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

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

            return configInfo;
        }
        public PHPConfigInfo GetPHPConfigInfo()
        {
            // Check if PHP is not registered
            if (_currentFastCgiApplication == null || _currentPHPHandler == null)
            {
                return null;
            }

            PHPConfigInfo configInfo = new PHPConfigInfo();
            configInfo.HandlerName = _currentPHPHandler.Name;
            configInfo.ScriptProcessor = _currentPHPHandler.ScriptProcessor;
            configInfo.Version = GetPHPExecutableVersion(_currentPHPHandler.ScriptProcessor);
            string phpIniPath = GetPHPIniPath();

            if (String.IsNullOrEmpty(phpIniPath))
            {
                throw new FileNotFoundException("php.ini file does not exist");
            }

            configInfo.PHPIniFilePath = phpIniPath;

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

            PHPIniSetting setting = file.GetSetting("error_log");
            if (setting != null)
            {
                configInfo.ErrorLog = setting.Value;
            }
            else
            {
                configInfo.ErrorLog = String.Empty;
            }

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

            return configInfo;
        }