PageRenderTime 69ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/stable-1.1.1/Client/PHPModule.cs

#
C# | 98 lines | 62 code | 23 blank | 13 comment | 4 complexity | 1a98f64324ff735a499861984d09e688 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. //-----------------------------------------------------------------------
  2. // <copyright>
  3. // Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
  4. //
  5. // This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
  6. // See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
  7. // </copyright>
  8. //-----------------------------------------------------------------------
  9. using System;
  10. using System.Diagnostics;
  11. using Microsoft.Web.Management.Client;
  12. using Microsoft.Web.Management.Server;
  13. using Web.Management.PHP.Extensions;
  14. using Web.Management.PHP.Settings;
  15. using Web.Management.PHP.Setup;
  16. namespace Web.Management.PHP
  17. {
  18. internal sealed class PHPModule : Module
  19. {
  20. private PHPModuleProxy _proxy;
  21. internal PHPModuleProxy Proxy
  22. {
  23. get
  24. {
  25. if (_proxy == null)
  26. {
  27. Connection connection = (Connection)GetService(typeof(Connection));
  28. _proxy = (PHPModuleProxy)connection.CreateProxy(this, typeof(PHPModuleProxy));
  29. }
  30. return _proxy;
  31. }
  32. }
  33. protected override void Initialize(IServiceProvider serviceProvider, ModuleInfo moduleInfo)
  34. {
  35. base.Initialize(serviceProvider, moduleInfo);
  36. IControlPanel controlPanel = (IControlPanel)GetService(typeof(IControlPanel));
  37. Debug.Assert(controlPanel != null, "Couldn't get IControlPanel");
  38. //PHPInfo page
  39. ModulePageInfo modulePageInfo = new ModulePageInfo(this,
  40. typeof(PHPInfoPage), Resources.PHPInfoPageTitle, Resources.PHPInfoPageDescription,
  41. Resources.PHPLogo16, Resources.PHPLogo32, Resources.PHPInfoPageLongDescription);
  42. controlPanel.RegisterPage(modulePageInfo);
  43. //PHP Settings page
  44. modulePageInfo = new ModulePageInfo(this,
  45. typeof(AllSettingsPage), Resources.AllSettingsPageTitle, Resources.AllSettingsPageDescription,
  46. Resources.PHPLogo16, Resources.PHPLogo32, Resources.AllSettingsPageLongDescription);
  47. controlPanel.RegisterPage(modulePageInfo);
  48. modulePageInfo = new ModulePageInfo(this,
  49. typeof(ErrorReportingPage), Resources.ErrorReportingPageTitle, Resources.ErrorReportingPageDescription,
  50. Resources.PHPLogo16, Resources.PHPLogo32, Resources.ErrorReportingPageLongDescription);
  51. controlPanel.RegisterPage(modulePageInfo);
  52. modulePageInfo = new ModulePageInfo(this,
  53. typeof(RuntimeLimitsPage), Resources.RuntimeLimitsPageTitle, Resources.RuntimeLimitsPageDescription,
  54. Resources.PHPLogo16, Resources.PHPLogo32, Resources.RuntimeLimitsPageLongDescription);
  55. controlPanel.RegisterPage(modulePageInfo);
  56. //PHP Extensions page
  57. modulePageInfo = new ModulePageInfo(this,
  58. typeof(AllExtensionsPage), Resources.AllExtensionsPageTitle, Resources.AllExtensionsPageDescription,
  59. Resources.PHPLogo16, Resources.PHPLogo32, Resources.AllExtensionsPageLongDescription);
  60. controlPanel.RegisterPage(modulePageInfo);
  61. //PHPPage - PHP feature start page
  62. modulePageInfo = new ModulePageInfo(this,
  63. typeof(PHPPage), Resources.PHPPageTitle, Resources.PHPPageDescription,
  64. Resources.PHPLogo16, Resources.PHPLogo32, Resources.PHPPageLongDescription);
  65. controlPanel.RegisterPage(ControlPanelCategoryInfo.Iis, modulePageInfo);
  66. controlPanel.RegisterPage(ControlPanelCategoryInfo.ApplicationDevelopment, modulePageInfo);
  67. }
  68. protected override bool IsPageEnabled(ModulePageInfo pageInfo)
  69. {
  70. Connection connection = (Connection)GetService(typeof(Connection));
  71. // We want the module configuration to be available on all levels except file.
  72. return (connection.ConfigurationPath.PathType != ConfigurationPathType.File);
  73. }
  74. }
  75. }