-
Notifications
You must be signed in to change notification settings - Fork 275
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
Plugin / Theme installation needs a way to define the path to install into. #1802
Comments
Note: This can be worked around with a step after the |
bazza
pushed a commit
to WordPress/wordpress.org
that referenced
this issue
Sep 25, 2024
…gainst an uploaded ZIP file, attempt to force the plugin to be installed into the expected folder path. This resolves issues of plugin check suggesting that the textdomain should be `2024_09_25-uploaded-file-SLUG` rather than `SLUG`. This is intended on being temporary until the upstream issue is resolved. See #7405. See WordPress/wordpress-playground#1802. git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14078 74240141-8908-4e6f-9713-ba540dce6ec7
adamziel
pushed a commit
that referenced
this issue
Oct 9, 2024
This allows for installing a user-generated ZIP file into a specific theme/plugin path. See #1802 ## Implementation details `InstallAssetOptions` has a new param, `targetSlug` (to match it's existing `targetPath`) which if set the ultimate install path is `targetPath/targetSlug`. If the param is not set, it defaults to guessing from the ZIP filename and ZIP contents as current. `InstallPluginOptions` and `InstallThemeOptions` both gain the same parameter, and pass it through if set. `InstallThemeOptions` was previously not actually in use, this fixes that, bringing it inline with `InstallPluginOptions`. Tests are a bit of a weird mess, as the testing structure doesn't cleanup between iteration runs, and the helper methods are different between each section. `zipFiles` helper from the plugin tests should probably be a common helper instead. The tests should show the current "issue" with 6b3b5a5 failing, and the latest changeset resolving that error. ## Testing Instructions (or ideally a Blueprint) ``` { "landingPage": "/wp-admin/admin.php?page=example", "steps": [ { "step": "login", "username": "admin", "password": "password" }, { "step": "installPlugin", "pluginZipFile": { "resource": "wordpress.org/plugins", "slug": "hello-dolly" }, "options": { "targetSlug": "hello-example-plugin" } }, { "step": "writeFile", "path": "/wordpress/wp-content/mu-plugins/example.php", "data": "<?php add_action('admin_menu', function(){ add_menu_page('Example','Example',0,'example',function(){ echo '<pre>'; print_r( glob( WP_PLUGIN_DIR . '/*' ) ); echo '</pre>'; }); } );" } ] } ``` This should display a admin page with the following output: ``` Array ( [0] => /wordpress/wp-content/plugins/hello-example-plugin [1] => /wordpress/wp-content/plugins/hello.php [2] => /wordpress/wp-content/plugins/index.php ) ```
Done in #1803 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently
installAsset
guesses the path to install an asset into based on two things:folder-name.zip
=>plugins/folder-name
)my-plugin
at the root level =>plugins/my-plugin
)This is not ideal in some scenario's, especially as some software and plugins expect the plugin to be installed into a very specific path.
For example, Plugin Check expects that the folder that the plugin is installed in is the ultimate slug on WordPress.org. This is usually incorrect, but is sometimes correct.
This becomes a problem when we're loading user-supplied ZIPs into playground, as we can't force the ultimate install path, and it may end up being something like
2024_09_25-uploaded-my-plugin
orMy-Plugin-For-Review
rather than the expectedhello-world-example
.Ideally,
InstallAssetOptions
would expose aslug
/installFolder
optional property that can be set viaInstallPluginOptions
, which forcesinstallAsset
.assetFolderName
rather than the heuristic guess that's presently in place.An example step after this would be, to install the
hello-dolly
plugin into a arbitraryhello-world-example
path:Another option would be that it's a property of the
FileReference
, but that might overload theFileReference
structure to be too asset-central.The text was updated successfully, but these errors were encountered: