コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
        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;
                }
            }
        }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
        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);
                }
            }
        }
コード例 #7
0
        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);
                }
            }
        }
コード例 #8
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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;
        }
コード例 #9
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        public void ApplyRecommendedSettings(ArrayList configIssueIndexes)
        {
            EnsureServerConnection();

            PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
            configHelper.ApplyRecommendedSettings(configIssueIndexes);
        }
コード例 #10
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        public void ApplyRecommendedSettings(ArrayList configIssueIndexes)
        {
            EnsureServerConnection();

            try
            {
                PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
                configHelper.ApplyRecommendedSettings(configIssueIndexes);
            }
            catch (FileNotFoundException)
            {
                RaiseException("ErrorPHPIniNotFound");
            }
        }
コード例 #11
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #12
0
 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);
     }
 }
コード例 #13
0
 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);
         }
     }
 }
コード例 #14
0
 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);
         }
     }
 }
コード例 #15
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #16
0
        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);
            }
        }
コード例 #17
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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;
        }
コード例 #18
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #19
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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;
        }
コード例 #20
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #21
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        public void SelectPHPVersion(string name)
        {
            EnsureServerOrSiteConnection();

            try
            {
                PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
                configHelper.SelectPHPHandler(name);
            }
            catch (FileLoadException)
            {
                RaiseException("ErrorSomeHandlersLocked");
            }
            catch (FileNotFoundException)
            {
                RaiseException("ErrorPHPIniNotFound");
            }
        }
コード例 #22
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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();
        }
コード例 #23
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #24
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        public object GetPHPIniSettings()
        {
            EnsureServerOrSiteConnection();

            PHPIniFile file = null;
            try
            {
                PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
                file = configHelper.GetPHPIniFile();
            }
            catch (FileNotFoundException)
            {
                RaiseException("ErrorPHPIniNotFound");
            }

            return file.GetData();
        }
コード例 #25
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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;
        }
コード例 #26
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #27
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #28
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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");
            }
        }
コード例 #29
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        public ArrayList GetAllPHPVersions()
        {
            EnsureServerOrSiteConnection();
            ArrayList versions = null;

            try
            {
                PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
                versions = configHelper.GetAllPHPVersions();
            }
            catch (FileNotFoundException)
            {
                RaiseException("ErrorPHPIniNotFound");
            }

            return versions;
        }
コード例 #30
0
ファイル: PHPService.cs プロジェクト: modulexcite/PHPManager
        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;
        }