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.IsObsoleteRelease) { _phpSetupItem.SetWarning(PrepareObsoleteReleaseWarning()); } else if (configInfo.IsCppRuntimeMissing) { _phpSetupItem.SetWarning(PrepareCppRuntimeMissingWarning()); } else if (configInfo.IsExpiringRelease) { _phpSetupItem.SetWarning(PrepareExpiringReleaseWarning()); } } 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 var errorLabel = new Label { 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); }
public bool CheckForLocalPHPHandler(string siteName, string virtualPath) { EnsureServerOrSiteConnection(); if (String.IsNullOrEmpty(siteName)) { throw new InvalidOperationException(); } Site site = ManagementUnit.ReadOnlyServerManager.Sites[siteName]; if (site == null) { throw new InvalidOperationException(); } ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(ManagementUnit.ReadOnlyServerManager, siteName, virtualPath); PHPConfigHelper configHelper = new PHPConfigHelper(serverManagerWrapper); PHPConfigInfo configInfo = configHelper.GetPHPConfigInfo(); if (configInfo.RegistrationType != PHPRegistrationType.FastCgi) { throw new InvalidOperationException("PHP is not registered via FastCGI, hence there is no FastCGI handler defined"); } return(configInfo.HandlerIsLocal); }
private void UpdatePageItemsState(PHPConfigInfo configInfo) { UpdatePHPSetupItem(configInfo); UpdatePHPSettingsItem(configInfo); UpdatePHPExtensionsItem(configInfo); PerformLayout(); }
internal PHPConfigInfo GetPHPConfigInfo() { object o = Invoke("GetPHPConfigInfo"); PHPConfigInfo result = null; if (o != null) { result = new PHPConfigInfo(); result.SetData(o); } return(result); }
private void OnGetSettingsCompleted(object sender, RunWorkerCompletedEventArgs e) { try { PHPConfigInfo configInfo = (PHPConfigInfo)e.Result; UpdatePageItemsState(configInfo); } catch (Exception ex) { DisplayErrorMessage(ex, Resources.ResourceManager); UpdatePageItemsState(null); } }
protected override void DoProcessing() { using (ServerManager serverManager = new ServerManager()) { ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(serverManager, this.SiteName, this.VirtualPath); PHPConfigHelper configHelper = new PHPConfigHelper(serverManagerWrapper); PHPConfigInfo configInfo = configHelper.GetPHPConfigInfo(); if (configInfo.RegistrationType == PHPRegistrationType.FastCgi) { PHPConfigurationItem configurationItem = new PHPConfigurationItem(configInfo); WriteObject(configurationItem); } else { throw new InvalidOperationException(Resources.PHPIsNotRegisteredError); } } }
private void UpdatePHPSettingsItem(PHPConfigInfo configInfo) { var 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); }
private void UpdatePHPExtensionsItem(PHPConfigInfo configInfo) { var 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); } }
public object GetPHPConfigInfo() { EnsureServerOrSiteConnection(); PHPConfigInfo result = null; try { var mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); var configHelper = new PHPConfigHelper(mgmtUnitWrapper); result = configHelper.GetPHPConfigInfo(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } return((result != null) ? result.GetData() : null); }
public PHPConfigurationItem(PHPConfigInfo configInfo) { _configInfo = configInfo; }