Secondary networks: sunrise queries unregistered scoped tables, and wu_{N}_* tables are never created
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start with inc/class-sunrise.php and inc/database/engine/class-table.php, then trace network scoped installation through inc/installers/class-core-installer.php and inc/loaders/class-table-loader.php. Read the table and email manager tests in the Files Scope, and check how setup state, table registration, and upgrade paths interact across secondary networks. Done means every secondary network has its scoped tables, sunrise queries avoid unregistered tables, and default system emails are available once its posts table exists.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
On a multi-network install, Ultimate Multisite queries network-scoped tables ({base_prefix}wu_{network_id}_*) on secondary networks, but two paths leave those tables unusable:
-
Sunrise domain mapping queries tables that were never registered.
Sunrise::load_domain_mapping()(inc/class-sunrise.php:191-205) startsDomain_Mappingon every network. On a network where Ultimate Multisite returns beforesetup_tables()(inc/class-wp-ultimo.php, theRequirements::met() === false || Requirements::run_setup() === falseearly return;run_setup()reads the per-networkwu_setup_finishedoption), noTableobject is built for that network. The domainQuerystill applies the network prefix (Network_Prefix::update_prefix_with_network_id(),inc/database/engine/traits/trait-network-prefix.php:20-25), so it reads$wpdb->wu_{N}_domain_mappings. That property is unset, which gives an empty table name:Table '<db>.wu_5_d' doesn't exist for query SELECT wu_5_d.id FROM wu_5_d WHERE wu_5_d.blog_id = 323 AND wu_5_d.domain != ...Note the double space: the table name is empty and only the alias
wu_5_dremains. Production logged about 170 of these in 7 hours on one template network. -
Secondary-network tables are never created.
Table::is_upgradeable()(inc/database/engine/class-table.php:50-57) returns false unless the request is on the main network and main site, somaybe_upgrade()never installswp_wu_{N}_*. A network ends up with none of these tables, or with only the subset some one-off path created. One network had customers/memberships/payments but noposts,postmeta,webhooks,passkey_credentials,webauthn_challenges,email_otp_attemptsorsso_nonces. Addon tables that extend the coreTable(e.g. metered-plans'metered_usage) inherit the same gap. A missingpoststable also means a network has no system emails (payment_received_*,site_published_*, …).
Expected
- Every secondary network that Ultimate Multisite serves has its full set of scoped tables, created idempotently when the network is first used or created, and on upgrade.
- Domain mapping at sunrise never builds a query against an unregistered table. Either register the network's tables (e.g. build the needed
Tableobjects inSunrise::load_domain_mapping()beforeDomain_Mappingruns), or fall back to the main network's tables when Ultimate Multisite is not set up on the current network. - Default system emails get created for a network once its
poststable exists.
Workaround applied on one install (not a fix)
Ran in each affected network's --url context:
$t->install()for everyTable_Loader::get_instance()->get_tables()entry, plusMetered_Usage_Table, whereexists()was false.Email_Manager::get_instance()->create_all_system_emails().- For the template network, set the
wu_setup_finishednetwork option so Ultimate Multisite completes loading and registers its tables.
Note: Table::exists() caches its result, so in the same process it still reported false right after a successful install(). A fresh process or information_schema showed the tables were present.
Files to modify
inc/class-sunrise.php(load_domain_mapping)inc/database/engine/class-table.php(is_upgradeable, and possibly theexists()cache)inc/installers/class-core-installer.php(network-scoped install)inc/loaders/class-table-loader.phpinc/managers/class-email-manager.php(create_all_system_emailson new networks)
Verification
On a multi-network test install:
- Create a secondary network without running the setup wizard and request one of its mapped domains. There should be no
FROM wu_N_(empty table) errors. - Every
get_tables()entry shouldexists()for that network after creation or upgrade. wu_get_emails()should return the default system emails on that network.
Files Scope
inc/class-sunrise.phpinc/database/engine/class-table.phpinc/installers/class-core-installer.phpinc/loaders/class-table-loader.phpinc/managers/class-email-manager.phptests/WP_Ultimo/Database/Engine/Table_Test.phptests/WP_Ultimo/Managers/Email_Manager_Test.php
aidevops.sh v3.39.49 plugin for OpenCode
- Vorherrschende Sprache
- PHP
- Sterne
- 218
- Forks
- 87
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 101
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Ultimate-Multisite/ultimate-multisite
-
Clearer default custom-domain DNS instructions and configurable DNS targetEvtl. vergeben @superdav42 hat das heute übernommen. Offenenhancement origin:worker source:ci-feedback status:in-review
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Ultimate-Multisite/ultimate-multisite#2067 · 14 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
fix: send payment_received receipt after manual payment confirmation and email verificationEvtl. vergeben @superdav42 hat das vor 5 Tagen übernommen. Offenbug origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2055 · 12 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
perf: lazy-load the top My Sites toolbar and defer initial site-list hydrationEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offenenhancement origin:worker priority:medium source:conflict-feedback status:available tier:standard
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Ultimate-Multisite/ultimate-multisite#2015 · 193 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
auto-dispatch needs-investigation origin:worker security status:available tier:standard type:bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 30/100
Ultimate-Multisite/ultimate-multisite#1930 ·
Maintainer antworten meist innerhalb von 1 Tag
-
hold-for-review no-auto-dispatch origin:interactive status:available type:bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Ultimate-Multisite/ultimate-multisite#1892 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in Ultimate-Multisite/ultimate-multisite
Ähnliche Issues
-
Recognise PHP_CodeSniffer (`phpcs`) as a linterEvtl. vergeben @HarshRajSinghania hat das heute übernommen. Offenenhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
MustacheCase/zanadir#507 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
jwage/phpamqplib-messenger#163 ·
-
Newsletter subscription page logs Undefined array key "nw_error" on every GETEvtl. vergeben @Codencode hat das heute übernommen. Offen
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
PrestaShop/ps_emailsubscription#145 · 1 Kommentar ·
-
PHP 8.5 CURL deprecatedOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
-
jira-created
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 2 Tagen