PHP Class VersionPress\Utils\WpConfigEditor

It's used mainly from our internal WP-CLI command update-config.
Exibir arquivo Open project: versionpress/versionpress Class Usage Examples

Public Methods

Method Description
__construct ( $wpConfigPath, $isCommonConfig )
removeVersionPressConstants ( array $configFiles ) Removes VersionPress public constants from config files.
updateConfigConstant ( $constantName, string | number | boolean $value, boolean $usePlainValue = false ) Sets value of a constant. It creates new one if it's missing.
updateConfigVariable ( $variableName, string | number | boolean $value, boolean $usePlainValue = false ) Sets value of a variable. It creates new one if it's missing.

Private Methods

Method Description
findPositionForAddingNewDefinition ( $wpConfigContent )
updateConfig ( $value, $replaceRegex, $definitionTemplate, $usePlainValue )

Method Details

__construct() public method

public __construct ( $wpConfigPath, $isCommonConfig )

removeVersionPressConstants() public static method

Removes VersionPress public constants from config files.
public static removeVersionPressConstants ( array $configFiles )
$configFiles array List of config file paths from which constants should be removed.

updateConfigConstant() public method

By default it saves string in single quotes. See $usePlainValue.
public updateConfigConstant ( $constantName, string | number | boolean $value, boolean $usePlainValue = false )
$constantName
$value string | number | boolean
$usePlainValue boolean The value is used as-is, without quoting.

updateConfigVariable() public method

By default it saves string in single quotes. See $usePlainValue.
public updateConfigVariable ( $variableName, string | number | boolean $value, boolean $usePlainValue = false )
$variableName
$value string | number | boolean
$usePlainValue boolean The value is used as-is, without quoting.