Skip to content
New issue

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

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

Already on GitHub? # to your account

Deleting compiled templates when migrating up can result in incorrect directory ownership #2771

Closed
OscarBarrett opened this issue Apr 19, 2018 · 1 comment

Comments

@OscarBarrett
Copy link

OscarBarrett commented Apr 19, 2018

Description

This change deletes compiled templates when migrating up. Because getCompiledTemplatesPath creates the directory if it doesn't exist, performing the migration as a user other than the one running the php/web process can prevent Craft from being able to write to the directory later on.

One situation where this could easily happen is running craft within a docker container with a non-persistent storage directory and migrations are run before starting the php process.

The workaround is to correct the permissions after running migrate/up.

Steps to reproduce

  1. rm -rf storage/runtime
  2. Run ./craft migrate/up --interactive=0 as root
  3. Start the php process

Additional info

  • Craft version: 3.0.3.1
  • PHP version: 7.2
  • Database driver & version: MySQL 5.7
  • Plugins & versions: N/A
@brandonkelly
Copy link
Member

Thanks for reporting that! Going forward, Craft is no longer going to create directories in the process of clearing them, if that’s the only thing it needed to do with the directory.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants