2024.8.23
Loading...
Searching...
No Matches
ActionSwitchApacheModule Class Reference

Public Member Functions

 __construct ($args)
 

Data Fields

const SWITCH_OFF = 'off'
 
const SWITCH_ON = 'on'
 

Detailed Description

Class ActionSwitchApacheModule

This class is responsible for enabling or disabling Apache modules by modifying the Apache configuration file.

Definition at line 15 of file class.action.switchApacheModule.php.

Constructor & Destructor Documentation

◆ __construct()

ActionSwitchApacheModule::__construct ( $args)

ActionSwitchApacheModule constructor.

Parameters
array$argsAn array containing the module name and the action (either 'on' or 'off').

Definition at line 25 of file class.action.switchApacheModule.php.

26 {
27 global $bearsamppBins;
28
29 if (isset($args[0]) && !empty($args[0]) && isset($args[1]) && !empty($args[1])) {
30 $onContent = 'LoadModule ' . $args[0];
31 $offContent = '#LoadModule ' . $args[0];
32
33 $httpdContent = file_get_contents($bearsamppBins->getApache()->getConf());
34 if ($args[1] == self::SWITCH_ON) {
35 $httpdContent = str_replace($offContent, $onContent, $httpdContent);
36 } elseif ($args[1] == self::SWITCH_OFF) {
37 $httpdContent = str_replace($onContent, $offContent, $httpdContent);
38 }
39
40 file_put_contents($bearsamppBins->getApache()->getConf(), $httpdContent);
41 }
42 }
global $bearsamppBins

References $bearsamppBins.

Field Documentation

◆ SWITCH_OFF

const ActionSwitchApacheModule::SWITCH_OFF = 'off'

◆ SWITCH_ON


The documentation for this class was generated from the following file: