Skip to content

Implement REST controller for block directory features.#17243

Closed
ck-lee wants to merge 1 commit intoWordPress:masterfrom
ck-lee:add/block-directory-controller
Closed

Implement REST controller for block directory features.#17243
ck-lee wants to merge 1 commit intoWordPress:masterfrom
ck-lee:add/block-directory-controller

Conversation

@ck-lee
Copy link
Contributor

@ck-lee ck-lee commented Aug 28, 2019

Description

This implements the REST controller required for the features to search, install and uninstall block for block directory features.

How has this been tested?

Tested locally

Screenshots

Types of changes

New feature (non-breaking change which adds functionality)
This PR is a split of #16524

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code has proper inline documentation.

include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );

$api = plugins_api(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably simplify this function to remove the need to query the API, providing some assumptions are true:

If the uninstall_block() method is only ever used to uninstall blocks that were installed using the install_block() method, and the slug is the plugin slug (which means it's also the folder name), then we can skip more or less straight to the deactivate_plugins() step.


include( ABSPATH . WPINC . '/version.php' );

$url = 'http://api.wordpress.org/plugins/info/1.2/';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should call plugins_api() instead of wp_remote_get().

@mapk mapk added the [Feature] Block Directory Related to the Block Directory, a repository of block plugins label Sep 12, 2019
@noisysocks
Copy link
Member

Closing in favour of #17431.

@noisysocks noisysocks closed this Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block Directory Related to the Block Directory, a repository of block plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants