Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions src/wp-admin/includes/class-bulk-plugin-upgrader-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ public function bulk_footer() {
),
'updates_page' => sprintf(
'<a href="%s" target="_parent">%s</a>',
self_admin_url( 'update-core.php' ),
self_admin_url( 'update-core.php?force-check=1' ),
__( 'Go to WordPress Updates page' )
),
);

if ( ! current_user_can( 'activate_plugins' ) ) {
unset( $update_actions['plugins_page'] );
}
Expand Down
12 changes: 12 additions & 0 deletions src/wp-admin/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,18 @@ function do_undismiss_core_update() {
$force_check = ! empty( $_GET['force-check'] );
wp_version_check( array(), $force_check );

if ( $force_check ) {
if ( current_user_can( 'update_plugins' ) ) {
delete_site_transient( 'update_plugins' );
wp_update_plugins();
}

if ( current_user_can( 'update_themes' ) ) {
delete_site_transient( 'update_themes' );
wp_update_themes();
}
}

require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
Expand Down
22 changes: 22 additions & 0 deletions tests/phpunit/tests/admin/wpUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,33 @@ public function tear_down() {
* @covers WP_Upgrader::__construct
*/
public function test_constructor_should_create_skin_when_one_is_not_provided() {

$instance = new WP_Upgrader();

$this->assertInstanceOf( WP_Upgrader_Skin::class, $instance->skin );
}

/**
* Tests that the bulk plugin updater footer links back to a fresh Updates screen check.
*
* @ticket 48364
*
* @covers Bulk_Plugin_Upgrader_Skin::bulk_footer
*/
public function test_bulk_plugin_upgrader_skin_updates_page_link_should_force_check() {

$skin = new Bulk_Plugin_Upgrader_Skin();
$upgrader = new WP_Upgrader( $skin );

$upgrader->init();

ob_start();
$skin->bulk_footer();
$output = ob_get_clean();

$this->assertStringContainsString( 'update-core.php?force-check=1', $output );
}

/**
* Tests that `WP_Upgrader::init()` calls `WP_Upgrader::set_upgrader()`.
*
Expand Down
Loading