cloudflare-php icon indicating copy to clipboard operation
cloudflare-php copied to clipboard

Not able to setMinification for the page rules.

Open erfan-ilyas opened this issue 5 years ago • 1 comments

Given in an error:

[code] => 1005 [message] => An invalid target or action was specified: Missing or unconfigured setting: 'minification'

On the API Docs:

https://api.cloudflare.com/#available-page-rules-for-a-zone-properties

There is not such $configuration['id'] as minification

I does have "id": "minify"

So on line 173 of PageRulesActions.php

I tried to set minify instead of minification but even then it throws a different error.

I am not a programmer so you must know best how to fix this.

Thanks for the great work.

erfan-ilyas avatar Jan 17 '21 16:01 erfan-ilyas

I am able to fix this with the following code:

/vendor/cloudflare/sdk/src/Configurations/PageRulesActions.php

Line: 171


    public function setMinification(bool $html, bool $css, bool $javascript)
    {
        $this->addConfigurationOption('minify', [
            'value' => [
                'html' => $this->getBoolAsOnOrOff($html),
                'css' => $this->getBoolAsOnOrOff($css),
		'js' => $this->getBoolAsOnOrOff($javascript),
            ],
        ]);
    }

CODE THAT IS NOT WORKING


    public function setMinification(bool $html, bool $css, bool $javascript)
    {
        $this->addConfigurationOption('minification', [
            'html' => $this->getBoolAsOnOrOff($html),
            'css' => $this->getBoolAsOnOrOff($css),
            'js' => $this->getBoolAsOnOrOff($javascript),
        ]);
    }

erfan-ilyas avatar Jan 17 '21 17:01 erfan-ilyas