[wp-trac] [WordPress Trac] #51779: wpdb->get_blog_prefix() doesn't allow wp_1_tablename structures

WordPress Trac noreply at wordpress.org
Sun Nov 15 15:42:46 UTC 2020


#51779: wpdb->get_blog_prefix() doesn't allow wp_1_tablename structures
--------------------------------+-----------------------------
 Reporter:  MadtownLems         |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  trunk
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 Context: We have some OLD networks (10+ years, started as WPMU, etc)

 In the process of dropping our Domain Mapping plugin for WordPress's
 native support, I encountered the following problem.  Some (probably very
 few) old networks have the root site's tables as wp_1_options (instead of
 wp_options).


 {{{
 if ( defined( 'MULTISITE' ) && ( 0 === $blog_id || 1 === $blog_id ) ) {
      return $this->base_prefix;
 }
 }}}


 This logic explicitly prevents wp_1_options and friends as being queried,
 with requests to the root/base site going to wp_options (which doesn't
 exist).

 Perhaps there could be some kind of sanity check that checks for the
 existence of tables with the prefix in this kind of situation?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51779>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list