Make WordPress Core


Ignore:
Timestamp:
09/06/2022 11:26:45 AM (22 months ago)
Author:
spacedmonkey
Message:

Networks and Sites: Use metadata api in *_network_options` functions.

Replace logic found in get_network_option, update_network_option and delete_network_option to use the metadata api. Using the metadata api has a number of benefits, such as consistency, default values and useful filters. This change also improves performance by priming the caches of all network options in a single database request.

Props spacedmonkey, swissspidy, sc0ttkclark, johnjamesjacoby, flixos90, jeremyfelt, pento, peterwilsoncc, mukesh27, desrosj.
Fixes #37181

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/Compression.php

    r53561 r54080  
    155155
    156156        // Check the site option is not changed due to lack of nonce.
    157         $this->assertSame( 0, get_site_option( 'can_compress_scripts' ) );
     157        $this->assertSame( 0, (int) get_site_option( 'can_compress_scripts' ) );
    158158
    159159        // Add a nonce.
     
    168168
    169169        // Check the site option is changed.
    170         $this->assertSame( 1, get_site_option( 'can_compress_scripts' ) );
     170        $this->assertSame( 1, (int) get_site_option( 'can_compress_scripts' ) );
    171171    }
    172172
     
    195195
    196196        // Check the site option is not changed due to lack of nonce.
    197         $this->assertSame( 1, get_site_option( 'can_compress_scripts' ) );
     197        $this->assertSame( 1, (int) get_site_option( 'can_compress_scripts' ) );
    198198
    199199        // Add a nonce.
     
    208208
    209209        // Check the site option is changed.
    210         $this->assertSame( 0, get_site_option( 'can_compress_scripts' ) );
     210        $this->assertSame( 0, (int) get_site_option( 'can_compress_scripts' ) );
    211211    }
    212212
Note: See TracChangeset for help on using the changeset viewer.