Skip to content
Merged
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
10 changes: 7 additions & 3 deletions inc/site-exporter/class-site-exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1420,10 +1420,14 @@
* registered on the parent page using event delegation so it is present
* before the modal opens.
*
* Hook: "wp-ultimo_page_wp-ultimo-sites" (network admin submenu under
* parent slug "wp-ultimo", menu slug "wp-ultimo-sites").
* The `wp-ultimo` parent is an admin-bar menu rather than a registered
* WordPress admin-menu parent. WordPress therefore emits
* `admin_page_wp-ultimo-sites` for the network Sites page. Keep the
* legacy submenu hook too for installations that register that parent.
*/
if ('wp-ultimo_page_wp-ultimo-sites' === $hook) {
$wp_sites_hooks = ['admin_page_wp-ultimo-sites', 'wp-ultimo_page_wp-ultimo-sites'];

if (in_array($hook, $wp_sites_hooks, true)) {
wp_enqueue_media();

wp_add_inline_script(
Expand Down Expand Up @@ -2660,7 +2664,7 @@

$export_name = sprintf('wu-site-export-%s-%s-%s.zip', $site_id, gmdate('Y-m-d'), time());

$command = new \TenUp\MU_Migration\Commands\ExportCommand();

Check warning on line 2667 in inc/site-exporter/class-site-exporter.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Instantiated class TenUp\MU_Migration\Commands\ExportCommand not found.

$base_path = wu_maybe_create_folder('wu-site-exports');

Expand Down Expand Up @@ -2820,7 +2824,7 @@

$this->load_dependencies();

$command = new \TenUp\MU_Migration\Commands\ImportCommand();

Check warning on line 2827 in inc/site-exporter/class-site-exporter.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Instantiated class TenUp\MU_Migration\Commands\ImportCommand not found.

$defaults = [
'url' => '',
Expand Down
18 changes: 18 additions & 0 deletions tests/WP_Ultimo/Site_Exporter_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@ public function test_wp_sites_row_actions_include_subsite_export_and_promotion()
$this->assertArrayHasKey('promote_main_site', $actions, 'Subsites must still offer Promote to Main Site');
}

/**
* Test the Ultimate Multisite Sites page receives the delegated ZIP-upload handler.
*/
public function test_wp_sites_scripts_enqueue_zip_upload_handler_for_actual_admin_hook(): void {

$this->exporter->enqueue_wp_sites_scripts('admin_page_wp-ultimo-sites');

$this->assertTrue(
wp_script_is('media-editor', 'registered'),
'The media editor script must be available on the Ultimate Multisite Sites page'
);

$inline_scripts = wp_scripts()->get_data('media-editor', 'after');

$this->assertIsArray($inline_scripts);
$this->assertStringContainsString('#wu-upload-zip-btn', implode("\n", $inline_scripts));
}

/**
* Test that bulk exports include the main site instead of silently skipping it.
*/
Expand Down
Loading