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);
                }
            }
        }
示例#8
0
        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
        public void ApplyRecommendedSettings(ArrayList configIssueIndexes)
        {
            EnsureServerConnection();

            PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
            configHelper.ApplyRecommendedSettings(configIssueIndexes);
        }
示例#10
0
        public void ApplyRecommendedSettings(ArrayList configIssueIndexes)
        {
            EnsureServerConnection();

            try
            {
                PHPConfigHelper configHelper = new PHPConfigHelper(ManagementUnit);
                configHelper.ApplyRecommendedSettings(configIssueIndexes);
            }
            catch (FileNotFoundException)
            {
                RaiseException("ErrorPHPIniNotFound");
            }
        }
示例#11
0
        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);
         }
     }
 }
示例#15
0
        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);
            }
        }
示例#17
0
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        public ArrayList GetAllPHPVersions()
        {
            EnsureServerOrSiteConnection();
            ArrayList versions = null;

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

            return versions;
        }
示例#30
0
        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;
        }