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

Fix the remote source folder structure if necessary. #574

Merged
merged 1 commit into from
Jul 6, 2024

Conversation

MehbubRashid
Copy link
Contributor

@MehbubRashid MehbubRashid commented Jul 6, 2024

The Problem/Issue

Many developers including the owner of this repository are well aware of the folder structure issue. Mostly it happens to MacOs users. When compressing the plugin folder to make a zip archive in Mac, it makes the zip structure like this:-

- my-plugin.zip
    - my-plugin.php
    - other-plugin-files.php

But it used to throw an error because WP requires the structure to be like:-

- my-plugin.zip
    - my-plugin 
        - my-plugin.php
        - other-plugin-files.php

that means The update archive should contain a single directory that contains the rest of plugin/theme files.
Till today, the solution for mac users was to use a different archiver software. Issue reference: #210 #482 #456 #159 #382 #62
Using different archiver tool does solve the problem, but thats not the best solution. Because it should work regardless the user is on mac or windows. I should not take extra steps just because I am a mac user. A developer in mac encounters this error first, and has to visit this repository to search for a solution. Thats not really a good experience.

Moreover, we should not maintain two zip file sources (One for downloading and another for update). Because, the default plugin uploader page of WordPress allows both type of zip file structure to install the plugin. It doesn't require a specific structure. Currently the same zip that works for plugin uploading, doesn't work for plugin update. Thats really a problem.

What's done and what's the benefit?

After extracting the remote zip, It re-structures and corrects the folder/zip structure - if not correct already. Now regardless of the zip structure, both mac and windows zip update works. Mac users doesn't have to face this issue and search for solutions.

Let me know your thoughts and I am open to make any changes if necessary. Thanks for this awesome package.

It re-structures and corrects the folder/zip structure of the extracted remote zip folder - if not correct already.
@YahnisElsts
Copy link
Owner

Looks good at a glance. Can you tell me how much testing you've done with this? Does WordPress successfully clean up everything in /wp-content/upgrade and /wp-content/upgrade-temp-backup after installing an update like this?

@MehbubRashid
Copy link
Contributor Author

MehbubRashid commented Jul 6, 2024

@YahnisElsts Thanks. Yes, I have checked and debugged line by line and saw WordPress deletes the folders from upgrade & upgrade-temp-backup folders after successful update. If you want to test it out, I can provide you with a test zip file made in MacOS.

@YahnisElsts
Copy link
Owner

All right, I ran a quick test myself to confirm, and it worked fine. I will merge this now.

@YahnisElsts YahnisElsts merged commit 668e416 into YahnisElsts:master Jul 6, 2024
1 check passed
@MehbubRashid
Copy link
Contributor Author

MehbubRashid commented Jul 7, 2024

@YahnisElsts thank you.

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

Successfully merging this pull request may close these issues.

2 participants