Skip to content

Export fatally crashes: mu-migration helpers.php not loaded because vendor/autoload.php is missing #1004

Description

@superdav42

Bug

Calling wu_exporter_export() (synchronous or via admin UI) fatally crashes with:

Fatal error: Call to undefined function TenUp\MU_Migration\Helpers\maybe_switch_to_blog()
in inc/site-exporter/mu-migration/includes/commands/class-mu-migration-export.php:396

Root Cause

Site_Exporter::load_dependencies() gates ALL file loading behind a check for inc/site-exporter/mu-migration/vendor/autoload.php, but that directory is not tracked in git and does not exist:

public function load_dependencies(): void {
    $base_path = wu_path('inc/site-exporter/mu-migration');
    if (file_exists($base_path . '/vendor/autoload.php')) {  // always false
        require_once $base_path . '/vendor/autoload.php';
        require_once $base_path . '/includes/helpers.php';    // never loaded
        // ...
    }
}

Meanwhile, the ExportCommand and ImportCommand classes ARE autoloaded by the main Composer classmap (in vendor/composer/autoload_classmap.php), so they can be instantiated — but they crash immediately when calling helper functions that were never loaded.

Steps to Reproduce

wp eval 'wu_exporter_export(2, ["uploads" => true], false);' --url=http://wordpress.local:8080

Or click "Export" on any site in the admin UI.

Expected

Export creates a ZIP file.

Actual

Fatal error — helpers.php functions undefined.

Fix

load_dependencies() should load helpers.php and the command classes unconditionally (they have no external dependency). The vendor/autoload.php check should only gate loading of the Alchemy\Zippy\Zippy dependency (which is handled by the separate Zippy issue).

Files to modify

  • EDIT: inc/site-exporter/class-site-exporter.php:1618-1632 — restructure load_dependencies() to always load helpers.php and command files; only gate vendor autoloader behind the file_exists check

Severity

Blocker — export is completely non-functional.


aidevops.sh v3.13.11 plugin for OpenCode v1.3.17 with claude-opus-4-6 spent 4m and 11,361 tokens on this as a headless worker.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingorigin:interactiveCreated by interactive user sessionstatus:in-progressWorker actively running

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions