protected override void DoProcessing() { using (ServerManager serverManager = new ServerManager()) { ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(serverManager, this.SiteName, this.VirtualPath); PHPConfigHelper configHelper = new PHPConfigHelper(serverManagerWrapper); RemoteObjectCollection<PHPVersion> phpVersions = configHelper.GetAllPHPVersions(); WildcardPattern nameWildcard = PrepareWildcardPattern(HandlerName); WildcardPattern versionWildcard = PrepareWildcardPattern(Version); bool isActive = true; foreach (PHPVersion phpVersion in phpVersions) { if (!nameWildcard.IsMatch(phpVersion.HandlerName)) { isActive = false; continue; } if (!versionWildcard.IsMatch(phpVersion.Version)) { isActive = false; continue; } PHPVersionItem versionItem = new PHPVersionItem(phpVersion, isActive); WriteObject(versionItem); isActive = false; } } }
protected override void DoProcessing() { using (ServerManager serverManager = new ServerManager()) { ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(serverManager, this.SiteName, this.VirtualPath); PHPConfigHelper configHelper = new PHPConfigHelper(serverManagerWrapper); PHPIniFile phpIniFile = configHelper.GetPHPIniFile(); PHPIniSetting setting = Helper.FindSetting(phpIniFile.Settings, Name); if (setting == null) { if (ShouldProcess(Name)) { RemoteObjectCollection<PHPIniSetting> settings = new RemoteObjectCollection<PHPIniSetting>(); settings.Add(new PHPIniSetting(Name, Value, Section)); configHelper.AddOrUpdatePHPIniSettings(settings); } } else { ArgumentException ex = new ArgumentException(String.Format(Resources.SettingAlreadyExistsError, Name)); ReportNonTerminatingError(ex, "InvalidArgument", ErrorCategory.InvalidArgument); } } }
protected override void DoProcessing() { using (var serverManager = new ServerManager()) { var serverManagerWrapper = new ServerManagerWrapper(serverManager, SiteName, VirtualPath); var configHelper = new PHPConfigHelper(serverManagerWrapper); var phpIniFile = configHelper.GetPHPIniFile(); var setting = Helper.FindSetting(phpIniFile.Settings, Name); if (setting != null) { if (ShouldProcess(Name)) { var settings = new RemoteObjectCollection<PHPIniSetting> { new PHPIniSetting(Name, Value, setting.Section) }; configHelper.AddOrUpdatePHPIniSettings(settings); } } else { var ex = new ArgumentException(String.Format(Resources.SettingDoesNotExistError, Name)); ReportNonTerminatingError(ex, "InvalidArgument", ErrorCategory.ObjectNotFound); } } }
protected override void DoProcessing() { using (var serverManager = new ServerManager()) { var serverManagerWrapper = new ServerManagerWrapper(serverManager, SiteName, VirtualPath); var configHelper = new PHPConfigHelper(serverManagerWrapper); var phpVersions = configHelper.GetAllPHPVersions(); var nameWildcard = PrepareWildcardPattern(HandlerName); var versionWildcard = PrepareWildcardPattern(Version); var isActive = true; foreach (var phpVersion in phpVersions) { if (!nameWildcard.IsMatch(phpVersion.HandlerName)) { isActive = false; continue; } if (!versionWildcard.IsMatch(phpVersion.Version)) { isActive = false; continue; } var versionItem = new PHPVersionItem(phpVersion, isActive); WriteObject(versionItem); isActive = false; } } }
protected override void DoProcessing() { using (ServerManager serverManager = new ServerManager()) { ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(serverManager, this.SiteName, this.VirtualPath); PHPConfigHelper configHelper = new PHPConfigHelper(serverManagerWrapper); PHPIniFile phpIniFile = configHelper.GetPHPIniFile(); PHPIniSetting setting = Helper.FindSetting(phpIniFile.Settings, Name); if (setting != null) { if (ShouldProcess(Name)) { string warningMessage = String.Format(Resources.DeleteSettingWarningMessage, setting.Name, setting.Value); if (Force || ShouldContinue(warningMessage, Resources.DeleteSettingWarningCaption)) { configHelper.RemovePHPIniSetting(setting); } } } else { ArgumentException ex = new ArgumentException(String.Format(Resources.SettingDoesNotExistError, Name)); ReportNonTerminatingError(ex, "InvalidArgument", ErrorCategory.ObjectNotFound); } } }
protected override void DoProcessing() { using (var serverManager = new ServerManager()) { var serverManagerWrapper = new ServerManagerWrapper(serverManager, SiteName, VirtualPath); var configHelper = new PHPConfigHelper(serverManagerWrapper); var phpIniFile = configHelper.GetPHPIniFile(); var nameWildcard = PrepareWildcardPattern(Name); var sectionWildcard = PrepareWildcardPattern(Section); foreach (var setting in phpIniFile.Settings) { if (!nameWildcard.IsMatch(setting.Name)) { continue; } if (!sectionWildcard.IsMatch(setting.Section)) { continue; } var settingItem = new PHPSettingItem(setting); WriteObject(settingItem); } } }
protected override void DoProcessing() { using (var serverManager = new ServerManager()) { var serverManagerWrapper = new ServerManagerWrapper(serverManager, SiteName, VirtualPath); var configHelper = new PHPConfigHelper(serverManagerWrapper); var phpIniFile = configHelper.GetPHPIniFile(); WildcardPattern wildcard = PrepareWildcardPattern(Name); foreach (var extension in phpIniFile.Extensions) { if (!wildcard.IsMatch(extension.Name)) { continue; } if (Status == PHPExtensionStatus.Disabled && extension.Enabled) { continue; } if (Status == PHPExtensionStatus.Enabled && !extension.Enabled) { continue; } var extensionItem = new PHPExtensionItem(extension); WriteObject(extensionItem); } } }
public string AddExtension(string extensionPath) { EnsureServerConnection(); string result = null; try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); result = configHelper.AddExtension(extensionPath); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorExtensionFileAlreadyExists"); } catch (Exception) { RaiseException("ErrorCannotAddExtension"); } return result; }
public void ApplyRecommendedSettings(ArrayList configIssueIndexes) { EnsureServerConnection(); PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.ApplyRecommendedSettings(configIssueIndexes); }
public void ApplyRecommendedSettings(ArrayList configIssueIndexes) { EnsureServerConnection(); try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.ApplyRecommendedSettings(configIssueIndexes); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } }
public void AddOrUpdateSettings(object settingsData) { EnsureServerConnection(); RemoteObjectCollection<PHPIniSetting> settings = new RemoteObjectCollection<PHPIniSetting>(); ((IRemoteObject)settings).SetData(settingsData); try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.AddOrUpdatePHPIniSettings(settings); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } }
protected override void DoProcessing() { try { using (ServerManager serverManager = new ServerManager()) { ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(serverManager, this.SiteName, this.VirtualPath); PHPConfigHelper _configHelper = new PHPConfigHelper(serverManagerWrapper); string phpCgiExePath = PrepareFullScriptProcessorPath(ScriptProcessor); _configHelper.RegisterPHPWithIIS(phpCgiExePath); } } catch (DirectoryNotFoundException ex) { ReportTerminatingError(ex, "DirectoryNotFound", ErrorCategory.ObjectNotFound); } }
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); } } }
protected override void DoProcessing() { using (ServerManager serverManager = new ServerManager()) { ServerManagerWrapper serverManagerWrapper = new ServerManagerWrapper(serverManager, this.SiteName, this.VirtualPath); PHPConfigHelper configHelper = new PHPConfigHelper(serverManagerWrapper); if (configHelper.GetPHPHandlerByName(HandlerName) != null) { if (ShouldProcess(HandlerName)) { configHelper.SelectPHPHandler(HandlerName); } } else { ArgumentException ex = new ArgumentException(String.Format(Resources.HandlerDoesNotExistError, HandlerName)); ReportNonTerminatingError(ex, "InvalidArgument", ErrorCategory.ObjectNotFound); } } }
public void AddOrUpdateSettings(object settingsData) { EnsureServerConnection(); var settings = new RemoteObjectCollection<PHPIniSetting>(); settings.SetData(settingsData); try { var mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); var configHelper = new PHPConfigHelper(mgmtUnitWrapper); configHelper.AddOrUpdatePHPIniSettings(settings); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } }
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); } }
public object GetPHPConfigInfo() { EnsureServerOrSiteConnection(); PHPConfigInfo result = null; try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); result = configHelper.GetPHPConfigInfo(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } return (result != null) ? result.GetData() : null; }
public void UpdateExtensions(object extensionsData) { EnsureServerConnection(); RemoteObjectCollection<PHPIniExtension> extensions = new RemoteObjectCollection<PHPIniExtension>(); ((IRemoteObject)extensions).SetData(extensionsData); try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.UpdateExtensions(extensions); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } }
public object GetPHPConfigInfo() { EnsureServerOrSiteConnection(); PHPConfigInfo result = null; try { ManagementUnitWrapper mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); PHPConfigHelper configHelper = new PHPConfigHelper(mgmtUnitWrapper); result = configHelper.GetPHPConfigInfo(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } return (result != null) ? result.GetData() : null; }
public void RemovePHPIniSetting(object settingData) { EnsureServerConnection(); PHPIniSetting setting = new PHPIniSetting(); setting.SetData(settingData); try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.RemovePHPIniSetting(setting); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } }
public void SelectPHPVersion(string name) { EnsureServerOrSiteConnection(); try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.SelectPHPHandler(name); } catch (FileLoadException) { RaiseException("ErrorSomeHandlersLocked"); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } }
public object GetPHPIniSettings() { EnsureServerOrSiteConnection(); PHPIniFile file = null; try { ManagementUnitWrapper mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); PHPConfigHelper configHelper = new PHPConfigHelper(mgmtUnitWrapper); file = configHelper.GetPHPIniFile(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } Debug.Assert(file != null); return file.GetData(); }
public void RegisterPHPWithIIS(string phpExePath) { EnsureServerConnection(); try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configHelper.RegisterPHPWithIIS(phpExePath); } catch (ArgumentException) { RaiseException("ErrorInvalidPHPExecutablePath"); } catch (FileNotFoundException) { RaiseException("ErrorNoPHPFilesInDirectory"); } catch (DirectoryNotFoundException) { RaiseException("ErrorNoExtDirectory"); } }
public object GetPHPIniSettings() { EnsureServerOrSiteConnection(); PHPIniFile file = null; try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); file = configHelper.GetPHPIniFile(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } return file.GetData(); }
public object GetPHPIniPhysicalPath() { if (!ManagementUnit.Context.IsLocalConnection) { return null; } string phpiniPath = null; try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); phpiniPath = configHelper.PHPIniFilePath; } catch(FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } return phpiniPath; }
public void RemovePHPIniSetting(object settingData) { EnsureServerConnection(); PHPIniSetting setting = new PHPIniSetting(); setting.SetData(settingData); try { ManagementUnitWrapper mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); PHPConfigHelper configHelper = new PHPConfigHelper(mgmtUnitWrapper); configHelper.RemovePHPIniSetting(setting); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } }
public void SelectPHPVersion(string name) { EnsureServerOrSiteConnection(); try { ManagementUnitWrapper mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); PHPConfigHelper configHelper = new PHPConfigHelper(mgmtUnitWrapper); configHelper.SelectPHPHandler(name); } catch (FileLoadException) { RaiseException("ErrorSomeHandlersLocked"); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } }
public void ApplyRecommendedSettings(ArrayList configIssueIndexes) { EnsureServerConnection(); try { ManagementUnitWrapper mgmtUnitWrapper = new ManagementUnitWrapper(ManagementUnit); PHPConfigHelper configHelper = new PHPConfigHelper(mgmtUnitWrapper); configHelper.ApplyRecommendedSettings(configIssueIndexes); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } catch (InvalidOperationException) { RaiseException("ErrorPHPIsNotRegistered"); } }
public ArrayList GetAllPHPVersions() { EnsureServerOrSiteConnection(); ArrayList versions = null; try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); versions = configHelper.GetAllPHPVersions(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } return versions; }
public object GetConfigIssues() { RemoteObjectCollection<PHPConfigIssue> configIssues = null; try { PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit); configIssues = configHelper.ValidateConfiguration(); } catch (FileNotFoundException) { RaiseException("ErrorPHPIniNotFound"); } return (configIssues != null) ? configIssues.GetData() : null; }