Skip to content

Feature Project/Feature Plugin for Plugin Dependencies #3032

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

Closed
wants to merge 334 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
334 commits
Select commit Hold shift + click to select a range
1a272de
update test
afragen Jul 4, 2022
68f5e87
fix tests
afragen Jul 4, 2022
7d35b44
add slugs with symbols
afragen Jul 4, 2022
43d3289
more tests
afragen Jul 4, 2022
9866cd9
Merge branch 'WordPress:trunk' into dependencies-tab
afragen Jul 19, 2022
4bab453
sync with feature plugin
afragen Jul 27, 2022
a7c06c7
unused
afragen Jul 27, 2022
6b6ccb1
Revert "Delete package-lock.json"
afragen Jul 28, 2022
1f39f09
Merge branch 'trunk' into dependencies-tab
afragen Jul 28, 2022
5915948
hopefully unf*ck package-lock.json
afragen Jul 28, 2022
0dc69f0
fix WPCS
afragen Jul 28, 2022
e488ebe
fix multisite compatibility
afragen Jul 28, 2022
52beecb
contributors is an array
afragen Jul 28, 2022
b2f5938
initialize with hook and static callback
afragen Jul 28, 2022
bc5b2da
add filter for switching non-premium slug to premium slug
afragen Sep 22, 2022
c38ff66
more error checking
afragen Sep 22, 2022
9ed68cf
circular dependencies, update to plugin
afragen Dec 17, 2022
70cafa3
Merge branch 'trunk' into dependencies-tab
afragen Dec 17, 2022
5cf9efa
update @since
afragen Dec 17, 2022
17dab20
fix for PHP coding standards
afragen Dec 17, 2022
d29761b
update since
afragen Feb 8, 2023
8aff8d9
Merge branch 'trunk' into dependencies-tab
afragen Feb 8, 2023
c4e4e37
Merge branch 'trunk' into dependencies-tab
afragen Feb 9, 2023
32799b6
cleanup docblocks
afragen Feb 9, 2023
492adc8
initialize on loading class
afragen Feb 9, 2023
c1cbc90
update for a11y
afragen Mar 1, 2023
f3940b1
Merge branch 'trunk' into dependencies-tab
afragen Apr 6, 2023
a0a1cf2
move filter upwards, more versatile
afragen Apr 6, 2023
d195a59
update action links
afragen Apr 6, 2023
2e76ac9
update regex, allow underscores, not symbols
afragen Apr 6, 2023
f31d96e
does need to run during AJAX
afragen Apr 8, 2023
afe770e
update generic plugin card
afragen Apr 8, 2023
64c4b5e
update regex to conform to plugin directory standards
afragen Apr 12, 2023
a48aa3a
update generic card short description
afragen Apr 12, 2023
fb7208b
make 'Cannot Install' button when package is empty
afragen Apr 12, 2023
36a0235
update conditional for button
afragen Apr 12, 2023
74273d3
forgot new tests
afragen Apr 12, 2023
e5a8783
add tests, but skip until Plugin Dependencies part 2
afragen Apr 12, 2023
eba26e4
don't skip, just remove until needed
afragen Apr 12, 2023
db924e9
new line before return
afragen Apr 12, 2023
6b78c5b
return generic plugin card data when needed
afragen Apr 12, 2023
07f75d1
fix conditional logic, more data for empty plugin card
afragen Apr 13, 2023
27c883e
add more data to generic plugin card
afragen Apr 13, 2023
119b1dd
wrap in p tag, spacing
afragen Apr 13, 2023
e2f1589
update for WP-CLI activate
afragen Apr 13, 2023
65d5b90
no need to start on hook
afragen Apr 13, 2023
b781d76
Merge branch 'trunk' into dependencies-tab
afragen May 22, 2023
75f2358
add function to create plugin install buttons and style
afragen May 22, 2023
e698813
update since
afragen Jul 3, 2023
4c34c44
bring inline with plugin, simpler plugin card
afragen Jul 10, 2023
a6bbd93
update button link to show Cannot Install as appropriate
afragen Jul 12, 2023
7d04466
update More details link
afragen Jul 12, 2023
694c349
updated css
afragen Aug 15, 2023
74249c6
updated to remove Dependencies tab and more of Ozz's feedback
afragen Aug 15, 2023
9f09070
wpcs fix
afragen Aug 15, 2023
2e9c149
remove as part of Dependencies tab
afragen Aug 15, 2023
4fc255c
add support for single file plugins
afragen Aug 18, 2023
8662ece
Revert "add support for single file plugins"
afragen Aug 18, 2023
8b16422
move to common.css
afragen Aug 23, 2023
fd8a2b4
remove from class
afragen Aug 23, 2023
929d9d2
move to src/js/_enqueues/admin
afragen Aug 23, 2023
38eba03
hopefully passes pagenow to function
afragen Aug 23, 2023
41a42fb
Merge branch 'trunk' into dependencies-tab
afragen Aug 29, 2023
463462d
deactivate Install Now button for empty package
afragen Aug 29, 2023
c1e0d8a
rename function
afragen Aug 29, 2023
6296e7d
make some callbacks static
afragen Aug 29, 2023
1a75b2c
lint
afragen Aug 29, 2023
79c603e
add filter to remove JS method of adding 'Requires:' to plugin row meta
afragen Aug 31, 2023
faa0ac0
add 'post_plugin_row_meta' filter
afragen Aug 31, 2023
9737bd1
check variable isset
afragen Aug 31, 2023
e813125
add filter to hide plugin row checkbox
afragen Sep 3, 2023
f42c85b
update to use filter to hide plugin row checkbox
afragen Sep 3, 2023
88468d0
must be static
afragen Sep 3, 2023
4beb7fc
make class static and move to WPINC
afragen Sep 3, 2023
f606d4f
load class
afragen Sep 3, 2023
501ce71
load WP_Plugin_Dependencies filters
afragen Sep 3, 2023
6ffdd5d
rearrange
afragen Sep 3, 2023
808e100
initialize() not static and run after require
afragen Sep 4, 2023
35cfa12
use require_once
afragen Sep 4, 2023
c3da97a
remove tests for function not in class
afragen Sep 4, 2023
261fd54
Update src/wp-admin/includes/class-wp-plugins-list-table.php
afragen Sep 4, 2023
64ee301
Merge remote-tracking branch 'afragen/dependencies-tab' into dependen…
afragen Sep 4, 2023
e4852f0
fix typo
afragen Sep 4, 2023
aa324e0
change to action hook
afragen Sep 4, 2023
f6015ab
back to static
afragen Sep 4, 2023
b56a9ef
update as escaped at output
afragen Sep 4, 2023
7ab27a7
update CSS and move to list-tables.css
afragen Sep 4, 2023
e85dc86
updated for new CSS
afragen Sep 4, 2023
7ff07aa
missed this bit of CSS for plugins row
afragen Sep 4, 2023
ba067e7
don't need parens for echo
afragen Sep 4, 2023
7a03d56
declare variables with values, remove constructor
afragen Sep 4, 2023
29840cb
use is_array instead of isset
afragen Sep 4, 2023
f2a41ba
refactor
afragen Sep 4, 2023
49a5144
missed this for plugin card iframe
afragen Sep 4, 2023
04fc447
move hooks to default-filters.php so they load earlier
afragen Sep 4, 2023
86f987c
Merge branch 'trunk' into dependencies-tab
afragen Sep 4, 2023
094525f
run load in is_admin
afragen Sep 4, 2023
e2780e8
correctly merge updates.js
afragen Sep 4, 2023
40364e1
update plugin card
afragen Sep 4, 2023
ed8996e
make identical
afragen Sep 5, 2023
4749ea2
Merge branch 'trunk' into dependencies-tab
afragen Sep 6, 2023
68cded2
update for refactor
afragen Sep 7, 2023
17e03f7
overly aggressive changing 'name' to 'Name'
afragen Sep 7, 2023
26ab8eb
use '! empty' as might be false
afragen Sep 7, 2023
3d031bd
updated tests
afragen Sep 8, 2023
5e4c7ae
make unique set
afragen Sep 8, 2023
5e12642
lint
afragen Sep 8, 2023
f79882e
Revert "lint"
afragen Sep 8, 2023
4189e40
only my tests
afragen Sep 8, 2023
3e500ba
update logic
afragen Sep 8, 2023
052638b
update tests
afragen Sep 8, 2023
57524c1
lint
afragen Sep 8, 2023
c32e003
rearrange the deck chairs
afragen Sep 8, 2023
0996a24
lint something
afragen Sep 8, 2023
68949d9
add docblock
afragen Sep 8, 2023
ce3d906
move testing directory
afragen Sep 8, 2023
14374ea
Revert "move testing directory"
afragen Sep 8, 2023
996726c
change directory name
afragen Sep 8, 2023
1984b1c
update phpcs rules to skip these UnitTestCase files
afragen Sep 8, 2023
b4ab7c2
update tests
afragen Sep 8, 2023
f52d298
Refactor
Sep 16, 2023
dc65f49
Merge pull request #4 from costdev/plugin-dependencies-refactor
afragen Sep 19, 2023
1dee825
Update src/wp-admin/includes/class-wp-plugin-install-list-table.php
afragen Sep 19, 2023
6a905c3
Update src/wp-admin/includes/class-wp-plugins-list-table.php
afragen Sep 19, 2023
3d1bee7
remove from phpcs.xml.dist
afragen Sep 19, 2023
7d860e9
Merge remote-tracking branch 'afragen/dependencies-tab' into dependen…
afragen Sep 19, 2023
36f11cb
Update src/wp-admin/includes/class-wp-plugins-list-table.php
afragen Sep 19, 2023
395f0b8
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
b839ae5
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
d2e25b4
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
7836ec4
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
bed2f01
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
3377028
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
bf0e329
Update class-wp-plugin-dependencies.php
afragen Sep 20, 2023
8667eaa
Update src/wp-includes/class-wp-plugin-dependencies.php
afragen Sep 20, 2023
f2f595c
lint
afragen Sep 20, 2023
dcf6458
Simplify logic to build dependent slugs.
Sep 20, 2023
1feb5c1
Add `get_dependents()` to the public API.
Sep 20, 2023
416f0e5
Add `get_dependencies()` to the public API.
Sep 20, 2023
38d3602
Remove `protected` `get_dependents()` and `get_dependencies()`.
Sep 20, 2023
c4a4cf4
Introduce and implement `convert_to_slug()`.
Sep 20, 2023
dc21402
Guard against missing filepath in `get_dependency_filepath()`.
Sep 20, 2023
456c8e0
Remove unnecessary `self::$plugins` guard.
Sep 20, 2023
f542b80
Introduce `get_dependency_filepath()`.
Sep 20, 2023
d92adc9
Fix erroneous use of `(string) 'requires_plugins'` as an array.
Sep 20, 2023
cc7d9d0
Merge pull request #5 from costdev/plugin-dependencies-updates
afragen Sep 20, 2023
2719172
update ::get_dependencies_notice()
afragen Sep 29, 2023
b68c8fd
Merge branch 'trunk' into dependencies-tab
afragen Sep 29, 2023
eec2c7f
lint
afragen Sep 29, 2023
4788e5a
missing variable in sprintf
afragen Sep 29, 2023
3267fb1
update docblock
afragen Sep 30, 2023
5370ffc
oops 🐿️
afragen Oct 3, 2023
31e5d04
Merge branch 'trunk' into dependencies-tab
afragen Oct 3, 2023
146567b
lint
afragen Oct 3, 2023
b6ce562
update since
afragen Oct 3, 2023
04d2ffa
not needed
afragen Oct 3, 2023
5f94ca7
split notices into separate functions
afragen Oct 3, 2023
8ed016c
too many %s, bad copy/paste
afragen Nov 21, 2023
9ab6f6c
remove outdated tests
afragen Jan 17, 2024
5bcfd4d
Merge branch 'trunk' into dependencies-tab
afragen Jan 17, 2024
6f580d2
remove outdated variable
afragen Jan 17, 2024
6c79d0a
linting
afragen Jan 17, 2024
9b13f05
more outdated variables
afragen Jan 17, 2024
d846321
Merge remote-tracking branch 'upstream/trunk' into pr/3032
azaozz Jan 18, 2024
a583470
Bootstrap/Load: Don't load WP_Plugin_Dependencies during test runs.
Jan 20, 2024
d1f084c
Require `WP_Plugin_Dependencies` in its tests.
Jan 20, 2024
179537f
Merge pull request #7 from costdev/plugin-dependencies/do_not_load_in…
afragen Jan 20, 2024
e195c80
Update tests after refactor.
Sep 20, 2023
4335970
Merge pull request #8 from costdev/plugin-dependencies-test-updates
afragen Jan 20, 2024
404786e
Remove errant comma in tests.
costdev Jan 20, 2024
e29ed0c
Merge branch 'dependencies-tab' of https://github.com/afragen/wordpre…
azaozz Feb 1, 2024
475ba7e
Merge remote-tracking branch 'upstream/trunk' into pr/3032
azaozz Feb 1, 2024
a112fd6
Merge branch 'trunk' into dependencies-tab
afragen Feb 1, 2024
c89bb48
Merge branch 'dependencies-tab' of https://github.com/afragen/wordpre…
azaozz Feb 1, 2024
84aff5a
Database: Store plugin data from `get_plugins()`.
Feb 1, 2024
3fda8dd
Database: Remove plugin data for a deleted plugin.
Feb 1, 2024
435e382
Bootstrap/Load: Check active plugins for missing requirements.
Feb 1, 2024
c7e3590
Upgrade/Install: Set/Update a plugin's data on package install.
Feb 2, 2024
9557904
Plugin Dependencies: Load from the database.
Feb 2, 2024
410f894
Plugin Dependencies: Require `wp-admin/includes/plugin.php` at the st…
Feb 2, 2024
3ab3157
Plugin Dependencies: Make `self::get_plugins()` use the database firs…
Feb 2, 2024
062dd64
Plugin Dependencies: Ensure plugin data exists when getting dirnames.
Feb 2, 2024
98c9a43
Plugin Dependencies: Use `self::get_plugins()` getting dependent names.
Feb 2, 2024
8e90639
Plugin Dependencies: Accommodate Hello Dolly when converting to a slug.
Feb 2, 2024
47890fd
Bootstrap/Load: Only show notices on Dashboard and `plugins.php`.
Feb 2, 2024
da39d40
Bootstrap/Load: Add a check for unmet dependencies.
Feb 2, 2024
a23d438
Plugin Dependencies: Only load `wp-admin/includes/plugin.php` where n…
Feb 2, 2024
2e2092e
Fix missing action links, add notices
azaozz Feb 2, 2024
38b6b81
Umm, remove blank line despite making it harder to read...
azaozz Feb 2, 2024
b779eb7
Fix white space in src/js/_enqueues/wp/updates.js
azaozz Feb 2, 2024
76552aa
Use printf() to output dependency warnings in src/wp-admin/includes/c…
azaozz Feb 2, 2024
5c8c1d4
Fix the 'since', and improve the warnings text
azaozz Feb 3, 2024
09f61e1
Updates: Do not close the modal on click.
Feb 3, 2024
f921901
Updates: Add logic for activating a plugin via AJAX.
Feb 3, 2024
47455cc
Updates: Remove modal closure on install/update.
Feb 3, 2024
2c89f55
Updates: Add the modal's footer to selectors.
Feb 3, 2024
1d0fdde
Updates: Abstract dependencies check logic to methods.
Feb 3, 2024
02fd68d
Updates: Add the dependencies check to `isValidResponse()`.
Feb 3, 2024
90e6f6b
AJAX: Add `wp_ajax_activate_plugin()`.
Feb 3, 2024
54459d5
AJAX: Add `activate-plugin` to `$core_actions_post`.
Feb 3, 2024
23f1bf3
Bootstrap/Load: Add `activate-plugin` to the protected actions.
Feb 3, 2024
7e6387b
Plugins: Add some extra data to `wp_get_plugin_action_button()`.
Feb 3, 2024
a52d289
Plugin Dependencies: Add some extra data to `::check_plugin_dependenc…
Feb 3, 2024
2249438
Updates: Add/protect stying for the buttons in cards and modals.
Feb 3, 2024
b7bf622
Plugins: Print the filesystem credentials modal in the plugin informa…
Feb 3, 2024
b78d382
Updates: Ensure the Update Now button uses the proper selectors.
Feb 3, 2024
fb82779
Updates: Add some styling for the Update Now button in the modal.
Feb 3, 2024
9e9dc45
Updates: Improve accessibility.
Feb 3, 2024
84b5e56
Plugins: Print the admin notice templates in the plugin information m…
Feb 3, 2024
32e6fd9
Updates: Add some styling for the notices in the modal.
Feb 3, 2024
aee6093
Updates: When a modal button updates, also update the card button.
Feb 3, 2024
e8c8c0d
Merge pull request #11 from azaozz/Plugin-Dependencies-add-notices-an…
afragen Feb 3, 2024
aced947
Merge branch 'plugin_dependencies_database_integration' into dependen…
afragen Feb 4, 2024
cbdc9c7
fix for empty database
afragen Feb 4, 2024
9f2f415
linting
afragen Feb 4, 2024
21987d8
Bootstrap/Load: Remove invalid plugins from `plugin_data` option.
Feb 4, 2024
0e08c85
Plugins: Prevent plugin activation for unmet plugin dependencies.
Feb 4, 2024
f83fdea
Plugin Dependencies: Only get dependency API data on `plugins.php` an…
Feb 4, 2024
8fbd51a
Merge pull request #13 from costdev/remove_invalid_plugins_from_plugi…
afragen Feb 4, 2024
d418da8
Merge pull request #15 from costdev/only_get_dependency_api_data_on_p…
afragen Feb 4, 2024
15eb523
Merge pull request #14 from costdev/prevent_activate_plugin_from_acti…
afragen Feb 5, 2024
9fd7c21
Bootstrap/Load: Only make `WP_Plugin_Dependencies::initialize()` cond…
Feb 5, 2024
0346bfd
Tests: Remove unnecessary `require_once()`.
Feb 5, 2024
b028632
Tests: Store reflected members rather than create new ones.
Feb 5, 2024
a8d101f
Tests: Add a test to make sure `hello.php` is converted to `hello-dol…
Feb 5, 2024
31f6f95
Merge pull request #16 from costdev/require_pd_but_just_dont_initiali…
afragen Feb 5, 2024
51a1be6
Merge pull request #17 from costdev/pd_tests_store_reflected_members_…
afragen Feb 5, 2024
a915341
Merge pull request #18 from costdev/pd_tests_add_hello_dolly_test_for…
afragen Feb 5, 2024
51d1459
Merge branch 'WordPress:trunk' into dependencies-tab
afragen Feb 5, 2024
ca06743
Merge branch 'dependencies-tab' into plugin_dependencies_modal_handling
afragen Feb 5, 2024
6fb61ad
Merge pull request #12 from costdev/plugin_dependencies_modal_handling
afragen Feb 5, 2024
eff3d7b
something different here
afragen Feb 5, 2024
11bba93
Coding Standards: Fix issues reported by JSHint.
Feb 5, 2024
7d2f883
Merge pull request #19 from costdev/pd_jshint
afragen Feb 5, 2024
1965881
Plugins: Correct key for `plugin_data` in `get_plugins()`.
costdev Feb 5, 2024
22c59a7
Merge pull request #20 from costdev/pd_fix_get_plugins_update_of_plug…
afragen Feb 5, 2024
7da7857
Source changes.
Feb 5, 2024
74cc7f3
Test changes
Feb 5, 2024
d5d2ba8
Merge pull request #21 from costdev/pd_tests_update
afragen Feb 5, 2024
3712583
linting
afragen Feb 5, 2024
b8bd492
Update tests.
costdev Feb 5, 2024
2bdfc3f
Fix detection for circular dependencies.
costdev Feb 5, 2024
70e71ff
Show 'Delete' for circular dependencies.
costdev Feb 5, 2024
b0ae348
Update circular dependency messaging.
costdev Feb 5, 2024
5b5205a
Merge pull request #22 from costdev/pd_fix_circular_dependencies
afragen Feb 5, 2024
c54ed7e
Add missing `::initialize()` call
costdev Feb 5, 2024
03af145
errant comma
afragen Feb 5, 2024
782bfd7
update since
afragen Feb 6, 2024
7cac1eb
change scope to protected
afragen Feb 6, 2024
20851cc
add @ticket to tests
afragen Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
681 changes: 559 additions & 122 deletions src/js/_enqueues/wp/updates.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/wp-admin/admin-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
'parse-media-shortcode',
'destroy-sessions',
'install-plugin',
'activate-plugin',
'update-plugin',
'crop-image',
'generate-password',
Expand Down Expand Up @@ -169,6 +170,9 @@

add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );

// Register Plugin Dependencies Ajax calls.
add_action( 'wp_ajax_check_plugin_dependencies', array( 'WP_Plugin_Dependencies', 'check_plugin_dependencies_during_ajax' ) );

$action = $_REQUEST['action'];

if ( is_user_logged_in() ) {
Expand Down
54 changes: 47 additions & 7 deletions src/wp-admin/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -1500,14 +1500,32 @@ div.error {
background-color: #f0f6fc;
}

#plugin-information-footer .update-now:not(.button-disabled):before {
color: #d63638;
content: "\f463";
display: inline-block;
font: normal 20px/1 dashicons;
margin: -3px 5px 0 -2px;
speak: never;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
}

#plugin-information-footer .notice {
margin-top: -5px;
}

.update-message p:before,
.updating-message p:before,
.updated-message p:before,
.import-php .updating-message:before,
.button.updating-message:before,
.button.updated-message:before,
.button.installed:before,
.button.installing:before {
.button.installing:before,
.button.activating-message:before,
.button.activated-message:before {
display: inline-block;
font: normal 20px/1 'dashicons';
-webkit-font-smoothing: antialiased;
Expand Down Expand Up @@ -1544,7 +1562,8 @@ div.error {
.updating-message p:before,
.import-php .updating-message:before,
.button.updating-message:before,
.button.installing:before {
.button.installing:before,
.button.activating-message:before {
color: #d63638;
content: "\f463";
}
Expand All @@ -1554,6 +1573,7 @@ div.error {
.import-php .updating-message:before,
.button.updating-message:before,
.button.installing:before,
.button.activating-message:before,
.plugins .column-auto-updates .dashicons-update.spin,
.theme-overlay .theme-autoupdate .dashicons-update.spin {
animation: rotation 2s infinite linear;
Expand All @@ -1564,6 +1584,7 @@ div.error {
.import-php .updating-message:before,
.button.updating-message:before,
.button.installing:before,
.button.activating-message:before,
.plugins .column-auto-updates .dashicons-update.spin,
.theme-overlay .theme-autoupdate .dashicons-update.spin {
animation: none;
Expand All @@ -1577,7 +1598,8 @@ div.error {
/* Updated icon (check mark). */
.updated-message p:before,
.installed p:before,
.button.updated-message:before {
.button.updated-message:before,
.button.activated-message:before {
color: #68de7c;
content: "\f147";
}
Expand Down Expand Up @@ -1662,19 +1684,37 @@ p.auto-update-status {
.button.updating-message:before,
.button.updated-message:before,
.button.installed:before,
.button.installing:before {
.button.installing:before,
.button.activated-message:before,
.button.activating-message:before {
margin: 3px 5px 0 -2px;
}

.button-primary.updating-message:before {
#plugin-information-footer .button.installed:before,
#plugin-information-footer .button.installing:before,
#plugin-information-footer .button.updating-message:before,
#plugin-information-footer .button.updated-message:before,
#plugin-information-footer .button.activated-message:before,
#plugin-information-footer .button.activating-message:before {
margin: 9px 5px 0 -2px;
}

#plugin-information-footer .button.update-now.updating-message:before {
margin: -3px 5px 0 -2px;
}

.button-primary.updating-message:before,
.button-primary.activating-message:before {
color: #fff;
}

.button-primary.updated-message:before {
.button-primary.updated-message:before,
.button-primary.activated-message:before {
color: #9ec2e6;
}

.button.updated-message {
.button.updated-message,
.button.activated-message {
transition-property: border, background, color;
transition-duration: .05s;
transition-timing-function: ease-in-out;
Expand Down
95 changes: 90 additions & 5 deletions src/wp-admin/css/list-tables.css
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,7 @@ th.sorted.desc:hover .sorting-indicator.asc:before {
z-index: 1;
}

.check-column input:where(:not(:disabled)):hover,
.check-column:hover input:where(:not(:disabled)) {
.check-column .label-covers-full-cell:hover + input:not(:disabled) {
box-shadow: 0 0 0 1px #2271b1;
}

Expand Down Expand Up @@ -1548,10 +1547,96 @@ div.action-links,
line-height: 1.3;
}

.plugin-card .name,
.plugin-card .desc {
margin-left: 148px; /* icon + margin */
margin-right: 128px; /* action links + margin */
margin-inline: 0;
}

.plugin-card .name, .plugin-card .desc > p {
margin-left: 148px;
}

@media (min-width: 1101px) {
.plugin-card .name, .plugin-card .desc > p {
margin-right: 128px;
}
}

@media (min-width: 481px) and (max-width: 781px) {
.plugin-card .name, .plugin-card .desc > p {
margin-right: 128px;
}
}

.plugin-card .column-description {
display: flex;
flex-direction: column;
justify-content: flex-start;
}

.plugin-card .column-description > p {
margin-top: 0;
}

.plugin-card .column-description .authors {
order: 1;
}

.plugin-card .column-description .plugin-dependencies {
order: 2;
}

.plugin-card .column-description p:empty {
display: none;
}

.plugin-card .plugin-dependencies {
background-color: #e5f5fa;
border-left: 3px solid #72aee6;
margin-bottom: .5em;
padding: 15px;
}

.plugin-card .plugin-dependencies-explainer-text {
margin-block: 0;
}

.plugin-card .plugin-dependency {
align-items: center;
display: flex;
flex-wrap: wrap;
margin-top: .5em;
column-gap: 1%;
row-gap: .5em;
}

.plugin-card .plugin-dependency:nth-child(2),
.plugin-card .plugin-dependency:last-child {
margin-top: 1em;
}

.plugin-card .plugin-dependency-name {
flex-basis: 74%;
}

.plugin-card .plugin-dependency .more-details-link {
margin-left: auto;
}

.rtl .plugin-card .plugin-dependency .more-details-link {
margin-right: auto;
}

@media (max-width: 939px) {
.plugin-card .plugin-dependency-name {
flex-basis: 69%;
}
.plugin-card .plugin-dependency .more-details-link {
}
}

.plugins #the-list .required-by,
.plugins #the-list .requires {
margin-top: 1em;
}

.plugin-card .action-links {
Expand Down
50 changes: 50 additions & 0 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4578,6 +4578,56 @@ function wp_ajax_install_plugin() {
wp_send_json_success( $status );
}

/**
* Handles activating a plugin via AJAX.
*
* @since 6.5.0
*/
function wp_ajax_activate_plugin() {
check_ajax_referer( 'updates' );

if ( empty( $_POST['name'] ) || empty( $_POST['slug'] ) || empty( $_POST['plugin'] ) ) {
wp_send_json_error(
array(
'slug' => '',
'pluginName' => '',
'plugin' => '',
'errorCode' => 'no_plugin_specified',
'errorMessage' => __( 'No plugin specified.' ),
)
);
}

$status = array(
'activate' => 'plugin',
'slug' => wp_unslash( $_POST['slug'] ),
'pluginName' => wp_unslash( $_POST['name'] ),
'plugin' => wp_unslash( $_POST['plugin'] ),
);

if ( ! current_user_can( 'activate_plugin', $status['plugin'] ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to activate plugins on this site.' );
wp_send_json_error( $status );
}

if ( is_plugin_active( $status['plugin'] ) ) {
$status['errorMessage'] = sprintf(
/* translators: %s: Plugin name. */
__( '%s is already active.' ),
$status['pluginName']
);
}

$activated = activate_plugin( $status['plugin'] );

if ( is_wp_error( $activated ) ) {
$status['errorMessage'] = $activated->get_error_message();
wp_send_json_error( $status );
}

wp_send_json_success( $status );
}

/**
* Handles updating a plugin via AJAX.
*
Expand Down
17 changes: 16 additions & 1 deletion src/wp-admin/includes/class-plugin-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ public function install( $package, $args = array() ) {
// Force refresh of plugin update information.
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );

$all_plugin_data = get_option( 'plugin_data', array() );
$plugin_file = $this->new_plugin_data['file'];
unset( $this->new_plugin_data['file'] );
$all_plugin_data[ $plugin_file ] = $this->new_plugin_data;
update_option( 'plugin_data', $all_plugin_data );

if ( $parsed_args['overwrite_package'] ) {
/**
* Fires when the upgrader has successfully overwritten a currently installed
Expand Down Expand Up @@ -482,7 +488,16 @@ public function check_package( $source ) {
foreach ( $files as $file ) {
$info = get_plugin_data( $file, false, false );
if ( ! empty( $info['Name'] ) ) {
$this->new_plugin_data = $info;
$basename = basename( $file );
$dirname = basename( dirname( $file ) );

if ( '.' === $dirname ) {
$plugin_file = $basename;
} else {
$plugin_file = "$dirname/$basename";
}
$this->new_plugin_data = ( $info );
$this->new_plugin_data['file'] = $plugin_file;
break;
}
}
Expand Down
Loading