public function setCommand($path, $value, $json = false)
    {
        if (!$this->configurationService->localIsActive($path)) {
            $this->outputLine('<warning>It seems that configuration for path "%s" is overridden.</warning>', [$path]);
            $this->outputLine('<warning>Writing the new value might have no effect.</warning>');
        }

        $encodedValue = $value;
        if ($json) {
            $encodedValue = @json_decode($value, true);
        }

        if ($encodedValue === null && strtolower($value) !== 'null') {
            $this->outputLine('<error>Could not decode value "%s" as json.</error>', [$value]);
            $this->quit(2);
        }

        $setWasAllowed = $this->configurationService->setLocal($path, $encodedValue);
        $isApplied = $this->configurationService->hasLocal($path);

        if (!$setWasAllowed) {
            $this->outputLine('<warning>Could not set value "%s" for configuration path "%s".</warning>', [$value, $path]);
            $this->outputLine('<warning>Possible reasons: configuration path is not allowed, configuration is not writable or type of value does not match given type.</warning>', [$value, $path]);
            $this->quit(1);
        }
        if ($isApplied) {
            $this->outputLine('<info>Successfully set value for path "%s".</info>', [$path]);
        } else {
            $this->outputLine('<warning>Value "%s" for configuration path "%s" seems not applied.</warning>', [$value, $path]);
            $this->outputLine('<warning>Possible reasons: changed value in AdditionalConfiguration.php or extension ext_localconf.php</warning>');
        }
    }
public function setCommand($path, $value, $json = false)
    {
        if (!$this->configurationService->localIsActive($path)) {
            $this->outputLine('<warning>It seems that configuration for path "%s" is overridden.</warning>', [$path]);
            $this->outputLine('<warning>Writing the new value might have no effect.</warning>');
        }

        $encodedValue = $value;
        if ($json) {
            $encodedValue = @json_decode($value, true);
        }

        if ($encodedValue === null && strtolower($value) !== 'null') {
            $this->outputLine('<error>Could not decode value "%s" as json.</error>', [$value]);
            $this->quit(2);
        }

        $setWasAllowed = $this->configurationService->setLocal($path, $encodedValue);
        $isApplied = $this->configurationService->hasLocal($path);

        if (!$setWasAllowed) {
            $this->outputLine('<warning>Could not set value "%s" for configuration path "%s".</warning>', [$value, $path]);
            $this->outputLine('<warning>Possible reasons: configuration path is not allowed, configuration is not writable or type of value does not match given type.</warning>', [$value, $path]);
            $this->quit(1);
        }
        if ($isApplied) {
            $this->outputLine('<info>Successfully set value for path "%s".</info>', [$path]);
        } else {
            $this->outputLine('<warning>Value "%s" for configuration path "%s" seems not applied.</warning>', [$value, $path]);
            $this->outputLine('<warning>Possible reasons: changed value in AdditionalConfiguration.php or extension ext_localconf.php</warning>');
        }
    }
public function setCommand ( $ path , $ value , $ json = false ) { if ( ! $ this -> configurationService -> localIsActive ( $ path ) ) { $ this -> outputLine ( '<warning>It seems that configuration for path "%s" is overridden.</warning>' , [ $ path ] ) ; $ this -> outputLine ( '<warning>Writing the new value might have no effect.</warning>' ) ; } $ encodedValue = $ value ; if ( $ json ) { $ encodedValue = @ json_decode ( $ value , true ) ; } if ( $ encodedValue === null && strtolower ( $ value ) !== 'null' ) { $ this -> outputLine ( '<error>Could not decode value "%s" as json.</error>' , [ $ value ] ) ; $ this -> quit ( 2 ) ; } $ setWasAllowed = $ this -> configurationService -> setLocal ( $ path , $ encodedValue ) ; $ isApplied = $ this -> configurationService -> hasLocal ( $ path ) ; if ( ! $ setWasAllowed ) { $ this -> outputLine ( '<warning>Could not set value "%s" for configuration path "%s".</warning>' , [ $ value , $ path ] ) ; $ this -> outputLine ( '<warning>Possible reasons: configuration path is not allowed, configuration is not writable or type of value does not match given type.</warning>' , [ $ value , $ path ] ) ; $ this -> quit ( 1 ) ; } if ( $ isApplied ) { $ this -> outputLine ( '<info>Successfully set value for path "%s".</info>' , [ $ path ] ) ; } else { $ this -> outputLine ( '<warning>Value "%s" for configuration path "%s" seems not applied.</warning>' , [ $ value , $ path ] ) ; $ this -> outputLine ( '<warning>Possible reasons: changed value in AdditionalConfiguration.php or extension ext_localconf.php</warning>' ) ; } }
Set configuration value

Set system configuration option value by path.

<b>Examples:</b>
<code>%command.full_name% SYS/fileCreateMask 0664</code>
<code>%command.full_name% EXTCONF/processor_enabled true --json</code>
<code>%command.full_name% EXTCONF/lang/availableLanguages '["de", "fr"]' --json</code>

@param string $path Path to system configuration
@param string $value Value for system configuration
@param bool $json Treat value as JSON (also makes it possible to force datatypes for value)
Set configuration value