One of the recent Craft updates (something close to 3.1.25) also brought a redactor migration (https://github.com/craftcms/redactor/blob/v2/src/migrations/m190225_003922_split_cleanup_html_settings.php), which fails when those 2 configs are disabled:

'allowAdminChanges' => false,
'useProjectConfigFile' => false,

The reason why it fails is that the migration tries to do something with projectConfig, which is read only when allowAdminChanges is disabled.


According to P&T this is expected behavior. Their solution is to put this in config/app.php:

'components' => [
    'projectConfig' => function() {
        $config = craft\helpers\App::projectConfigConfig();
        $config['readOnly'] = false;
        return Craft::createObject($config);

(Thanks Oli, Brandon, Andris!)

Since I do all migration via Craft's console commands, this shorter solution works for me:

'allowAdminChanges' => (php_sapi_name() === 'cli')

It simply enables admin changes when using the console command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.