Directory

Failure when activating plugin zip containing files in subdirectory · Issue #881 · WordPress/wordpress-playground · GitHub
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

Failure when activating plugin zip containing files in subdirectory #881

Closed
tellyworth opened this issue Dec 19, 2023 · 2 comments
Closed
Labels
[Package][@wp-playground] Blueprints [Priority] High [Type] Bug An existing feature does not function as intended

Comments

@tellyworth
Copy link

When loading a plugin via a blueprint pluginZipFile step, Playground seems to fail silently if the zip file contains its php files in a subdirectory. It produces a console error like this:

Proceeding without the FILE.ZIP plugin. Could not install it in wp-admin. The original error was: Error: Could not find plugin entry file.

Installing the exact same zip file via Add New Plugins in wp-admin works fine. I think this is likely because the blueprint plugin install/activate step doesn't recurse into subdirectories:

foreach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {

..whereas I think there's some magic code in core's unzip_file() function that quietly lops off a leading subdirectory when unzipping the package to install. That's an educated guess though, I haven't confirmed it.

@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Priority] High labels Dec 19, 2023
@adamziel
Copy link
Collaborator

@tellyworth would you share the zip file that causes that error? The installPlugin step is supposed to handle a scenario where the zip file contains a single directory where the plugin files are stored, there's even a test case for that:

php.mkdir(`/${pluginName}`);
php.writeFile(
`/${pluginName}/index.php`,
`/**\n * Plugin Name: Test Plugin`
);

@adamziel
Copy link
Collaborator

Fixed in #894

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@wp-playground] Blueprints [Priority] High [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

No branches or pull requests

2 participants