close
The Wayback Machine - https://web.archive.org/web/20220320184126/https://github.com/WordPress/performance/pull/87
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

Introduce perflab_active_modules filter to control which modules are active #87

Merged
merged 8 commits into from Jan 18, 2022

Conversation

eugene-manuilov
Copy link
Contributor

@eugene-manuilov eugene-manuilov commented Jan 12, 2022

Addresses #33

Copy link
Member

@felixarntz felixarntz left a comment

@eugene-manuilov Looks great!

I left one comment below that doesn't block this from being merged, but we'll need to keep this in mind. Maybe it's better for now to put 1.0.0 like we have elsewhere. However, I think it'd be great to have an issue bringing up the n.e.x.t proposal.

load.php Outdated
/**
* Filters active modules to allow programmatically control which modules are active.
*
* @since n.e.x.t
Copy link
Member

@felixarntz felixarntz Jan 14, 2022

Choose a reason for hiding this comment

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

We don't have the n.e.x.t convention here so far, but it's worth evaluating. Do you mind opening an issue where we can propose/discuss it? It would be important to document this somewhere eventually. We haven't published a release yet, but once we get to that, we'll need to have documentation anyway.

Maybe we could even have a npm script that replaces all n.e.x.t occurrences with a specific version.

Copy link
Contributor Author

@eugene-manuilov eugene-manuilov Jan 15, 2022

Choose a reason for hiding this comment

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

Updated and added a new ticket: #90

Copy link
Member

@felixarntz felixarntz left a comment

Re-approving for the additional (mini-)change.

@JustinyAhin
Copy link
Member

@JustinyAhin JustinyAhin commented Jan 17, 2022

@eugene-manuilov could provide a snippet of how to test the filter, in a mu-plugin for instance? Thanks :)

@tillkruss
Copy link
Member

@tillkruss tillkruss commented Jan 17, 2022

@eugene-manuilov could provide a snippet of how to test the filter, in a mu-plugin for instance? Thanks :)

add_filter( 'perflab_active_modules', function ( $modules ) {
    return array_diff( $modules, [ "foo", "bar" ] ); // modules you want to remove
} );

add_filter( 'perflab_active_modules', function ( $modules ) {
    return array_merge( $modules, [ "foo", "bar" ] ); // modules you want to add
} );

@JustinyAhin
Copy link
Member

@JustinyAhin JustinyAhin commented Jan 18, 2022

Thanks, @tillkruss

@felixarntz felixarntz merged commit a1ca4ff into trunk Jan 18, 2022
5 checks passed
@felixarntz felixarntz changed the title Allow programmatic control of active modules via filter Introduce perflab_active_modules filter to control which modules are active Jan 18, 2022
@tillkruss tillkruss deleted the feature/modules-control-filter branch Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants