Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something goes wrong setting options / saving to database #89

Closed
huubl opened this issue Aug 20, 2021 · 7 comments
Closed

Something goes wrong setting options / saving to database #89

huubl opened this issue Aug 20, 2021 · 7 comments

Comments

@huubl
Copy link
Contributor

huubl commented Aug 20, 2021

Hi,

Something goes wrong when using this settings:

<?php
use function Env\env;

return [
    'application' => [
        'general' => [
            'site-title' => 'My website',
            'wp-address' => env('WP_SITEURL'),
            'site-address' => env('WP_HOME'),
            'admin-email' => 'my@email.com',
            'admin-email.verification' => false,
            'email-from' => 'info@mysite.nl',
            'email-from-name' => 'My website',
            'membership' => false,
            'default-role' => 'subscriber',
            'language' => 'nl_NL',
            'timezone' => 'Europe/Amsterdam',
            'date-format' => 'j F Y',
            'time-format' => 'H:i',
            'week-starts' => 'Mon',
        ],
        'writing' => [
            'emoji' => false,
            'default-category' => 1,
            'default-post-format' => 'standard',
            'post-via-email.server' => 'mail.example.com',
            'post-via-email.port' => 110,
            'post-via-email.login' => 'login@example.com',
            'post-via-email.pass' => 'password',
            'post-via-email.default-category' => 1,
            'update-services' => 'http://rpc.pingomatic.com/',
        ],
        'reading' => [
            'front-page' => 2,
            'front-page.posts' => 454,
            'posts-per-page' => 9,
            'posts-per-rss' => 9,
            'rss-excerpt' => 'summary',
        ],
        'media' => [
            'sizes.thumbnail' => [
                'width' => 300,
                'height' => 200,
                'crop' => true,
            ],
            'sizes.medium' => [
                'width' => 640,
                'height' => 480,
            ],
            'sizes.large' => [
                'width' => 1100,
                'height' => 800,
            ],
            'uploads.organize' => true,
        ],
        'permalinks' => [
            'structure' => '/nieuws/%year%/%monthnum%/%day%/%postname%/',
            'category-base' => 'nieuws/categorie',
            'tag-base' => 'nieuws/tag',
        ],
        'privacy.policy-page' => 2731,
    ],
];

When I check the database values, they are not changing or (when I click save on the admin general settings page ) wrong. For example the media options get:

option_name option_value autoload
thumbnail_size_w 0 no
thumbnail_size_h 0 no
thumbnail_crop 1 no
medium_size_w 0 no
medium_size_h 0 no

When saving the (partly) locked setting on the admin general settings page (by the save button ) and then comment out the application -> general settings I get this:

image

Am I doing something wrong?

  • Using Intervention dev-master branch (loaded as mu-plugin)
  • Bedrock / Sage 10
@darrenjacoby
Copy link
Owner

Hey @huubl,

I’m on my phone now, but the new versions use pre_option which is faster than updating the db, so it wouldn’t reflect in the db itself. I am working on providing a sync option to update the db, should be releasing that soon.

@darrenjacoby
Copy link
Owner

darrenjacoby commented Aug 20, 2021

Hey @huubl,

Just tested with a new copy from dev-master here and no problems with the above config.

EDIT: just re-read your comment, and that behaviour sounds correct. Intervention does not update the DB by using application (it did in previous versions). There will be an option for this soon. Without application being set, or intervention being active, it will revert to the previous db settings.

#64 for reference.

image

@darrenjacoby
Copy link
Owner

darrenjacoby commented Aug 22, 2021

@huubl ,

Interesting, I was finally able to replicate. The problem is that Intervention is setting fields in application as disabled on the option pages, and so when you save settings from WP, the disabled field values aren't pulling through on save and instead clearing the DB entries. Not ideal. I think changing from disabled to readonly will solve the issue, but still testing.

@darrenjacoby
Copy link
Owner

Really appreciate you picking this up, got a hotfix up which should solve it. Let me know if it does it for you. cf57d4a

@jmerilainen
Copy link

Related to the fix: the Sober\Intervention\UserInterface\Tools\Import class is missing from the repo.

@darrenjacoby
Copy link
Owner

@jmerilainen ah thanks! fixed.

@huubl
Copy link
Contributor Author

huubl commented Aug 24, 2021

Hi @darrenjacoby,

I missed #64 Intervention using the pre_option now. I tried the current master branch with hotfix and it solves the problem.

Thanks for looking in to this!

@huubl huubl closed this as completed Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants