[wp-trac] [WordPress Trac] #41685: Save database version in site meta (Multisite)

WordPress Trac noreply at wordpress.org
Thu Jun 20 13:40:04 UTC 2019


#41685: Save database version in site meta (Multisite)
----------------------------------------+------------------------
 Reporter:  spacedmonkey                |       Owner:  (none)
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  5.3
Component:  Networks and Sites          |     Version:  3.0
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:  multisite
----------------------------------------+------------------------
Changes (by leogermani):

 * keywords:  needs-unit-tests has-patch needs-refresh => needs-unit-tests
     has-patch


Comment:

 == Patch ==

 I've refreshed the patch, but looking at it I realized it only updates
 this info when a db upgrade runs... Isn't it a good idea to add this to
 the multisite activation somehow to make sure this information is always
 present? even in a fresh install?

 == Tests ==

 I was not able to write the tests and would need some help here. Calling
 `wp_upgrade()` does not seem to trigger the actual function in the tests
 environment. Maybe something to do with the pluggable functions... Or
 maybe Im just missing somehting... Im not sure...

 This is what I was working on for tests (draft code)


 {{{
 /**
  * @ticket 41685
  */
 public function test_update_db_info_upon_db_update() {

         if ( ! is_site_meta_supported() ) {
                 $this->markTestSkipped( 'Tests only runs with the blogmeta
 database table installed' );
         }

         global $wp_db_version;
         // force a fake upgrade
         $wp_db_version ++;

         wp_upgrade();

         $x = get_site_meta( self::$site_id, 'db_version', true );

         // check if current site metadata was upgraded...
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41685#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list