Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Secondary networks: sunrise queries unregistered scoped tables, and wu_{N}_* tables are never created

オープン
#2,012 コメント 13 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@superdav42 がすでに取り組んでいます。

2026年10月22日 から。

  • #2013 @superdav42 による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php, wordpress
領域
backend, database

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

bug origin:interactive status:in-review

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:

  1. Sunrise domain mapping queries tables that were never registered. Sunrise::load_domain_mapping() (inc/class-sunrise.php:191-205) starts Domain_Mapping on every network. On a network where Ultimate Multisite returns before setup_tables() (inc/class-wp-ultimo.php, the Requirements::met() === false || Requirements::run_setup() === false early return; run_setup() reads the per-network wu_setup_finished option), no Table object is built for that network. The domain Query still 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_d remains. Production logged about 170 of these in 7 hours on one template network.

  2. 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, so maybe_upgrade() never installs wp_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 no posts, postmeta, webhooks, passkey_credentials, webauthn_challenges, email_otp_attempts or sso_nonces. Addon tables that extend the core Table (e.g. metered-plans' metered_usage) inherit the same gap. A missing posts table 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 Table objects in Sunrise::load_domain_mapping() before Domain_Mapping runs), 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 posts table exists.

Workaround applied on one install (not a fix)

Ran in each affected network's --url context:

  • $t->install() for every Table_Loader::get_instance()->get_tables() entry, plus Metered_Usage_Table, where exists() was false.
  • Email_Manager::get_instance()->create_all_system_emails().
  • For the template network, set the wu_setup_finished network 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 the exists() cache)
  • inc/installers/class-core-installer.php (network-scoped install)
  • inc/loaders/class-table-loader.php
  • inc/managers/class-email-manager.php (create_all_system_emails on new networks)

Verification

On a multi-network test install:

  1. 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.
  2. Every get_tables() entry should exists() for that network after creation or upgrade.
  3. wu_get_emails() should return the default system emails on that network.
Files Scope
  • inc/class-sunrise.php
  • inc/database/engine/class-table.php
  • inc/installers/class-core-installer.php
  • inc/loaders/class-table-loader.php
  • inc/managers/class-email-manager.php
  • tests/WP_Ultimo/Database/Engine/Table_Test.php
  • tests/WP_Ultimo/Managers/Email_Manager_Test.php

aidevops.sh v3.39.49 plugin for OpenCode

主要言語
PHP
スター
218
フォーク
87
平均マージ
1日 7時間
マージ済み PR(30日)
85

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Ultimate-Multisite/ultimate-multisite のほかの issue

Ultimate-Multisite/ultimate-multisite の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。