Cms: [3.5-rc1.1] New fields can be lost if "config/project"-dir is not writable on dev-environment

Created on 23 Jul 2020  Â·  5Comments  Â·  Source: craftcms/cms

Description

Creating new fields, which would normally result in a new project config file being created, are deleted again when a field is created on a development environment where the config/project directory is not writable.

I would either expect not being to be able to create new fields at all, or to have the field persist despite the config not being writable. Once the permissions are fixed, the field should be created in the project config file structure (eg. trough project-config/rebuild).

Additionally, it appears Craft does not pick up on the directory permissions being fixed until after a manual cache clear.

Steps to reproduce

  1. Have a read-only or non-writable config/project dir
  2. Have an environment where devMode => true (I believe this triggers the auto-sync?)
  3. Create a new field through the UI
  4. The new field will show up in places
  5. Clear the cache or click through some random pages in the admin
  6. The new field will disappear (changes to existing fields, however, appear to persist)

Additional info

  • Craft version: 3.5-rc1.1
  • PHP version: 7.2
  • Database driver & version: MySQL 5.7
  • Plugins & versions: n/a
bug project config

All 5 comments

To clarify:

Clear the cache or click through some random pages in the admin
The new field will disappear (changes to existing fields, however, appear to persist)

this occurred after you cleared the caches and clicked "Yes" in the "Apply project config changes?" dialog. Does that sound correct?

I don't recall exactly what caused the field to disappear, I didn't get the
prompt to apply the changes from config I think. If I recall correctly it
was "just gone" after a few clicks in the admin panel.

On Mon, 27 Jul 2020, 14:41 Andris Sevcenko, notifications@github.com
wrote:

To clarify:

Clear the cache or click through some random pages in the admin
The new field will disappear (changes to existing fields, however, appear
to persist)

this occurred after you cleared the caches and clicked "Yes" in the "Apply
project config changes?" dialog. Does that sound correct?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/craftcms/cms/issues/6438#issuecomment-664372047, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AADF5CFA3TZDOYN2IAED4F3R5VYY3ANCNFSM4PFOUOCA
.

Ah. Actually, the behavior might have changed between RC1 and RC3. Either way, I made this even more robust now for the next 3.5 release and this should not happen again!

Going forward, an exception will be thrown immediately when Craft is unable to write the new project config files in full, and will continue to be thrown until the problem is resolved. Should give you plenty of warning to fix the folder permissions before any damage is done.

Craft 3.5 RC4 is out now with that change.

Was this page helpful?
0 / 5 - 0 ratings