YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.22k stars 403 forks source link

What file permissions are best practice? #485

Closed JohnDeeBDD closed 1 year ago

JohnDeeBDD commented 2 years ago

I'm deploying a plugin with zips created on a linux box [.zip in linux preserves permissions]. What are the best permission settings to set before I zip? I got "Update failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions."

YahnisElsts commented 2 years ago

I'm not very familiar with this aspect of the installation process, but I would guess that the permissions in the .zip file do not matter. Looking at the _unzip_file_ziparchive() and _unzip_file_pclzip() functions in WordPress core, it appears that they just set the permissions of all extracted files to the FS_CHMOD_FILE constant . The code doesn't look at the permissions stored in the .zip file.

In this case, it's more likely that the target site has a permissions issue. Maybe some wp-content subdirectories don't have the right permissions? Or maybe PHP is running under the wrong user account?

JohnDeeBDD commented 1 year ago

In this case, it's more likely that the target site has a permissions issue. <-- Correct. Thanks Yahnis.