<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56445] trunk: Options, Meta APIs: Introduce `prime_options()` to load multiple options with a single database request.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56445">56445</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56445","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>flixos90</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-08-24 14:40:01 +0000 (Thu, 24 Aug 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Options, Meta APIs: Introduce `prime_options()` to load multiple options with a single database request.
WordPress's `get_option()` function generally relies on making individual database requests for each option, however with the majority of options (in most cases) being autoloaded, i.e. fetched once with a single database request and then stored in (memory) cache.
As part of a greater effort to reduce the amount of options that are unnecessarily autoloaded, this changeset introduces an alternative way to retrieve multiple options in a performant manner, with a single database request. This provides a reasonable alternative for e.g. plugins that use several options which only need to be loaded in a few specific screens.
Specifically, this changeset introduces the following functions:
* `prime_options( $options )` is the foundation to load multiple specific options with a single database request. Only options that aren't already cached (in `alloptions` or an individual cache) are retrieved from the database.
* `prime_options_by_group( $option_group )` is a convenience wrapper function for the above which allows to prime all options of a specific option group (as configured via `register_setting()`).
* `get_options( $options )` is another wrapper function which first primes the requested options and then returns them in an associative array, calling `get_option()` for each of them.
Props mukesh27, joemcgill, costdev, olliejones.
Fixes <a href="https://core.trac.wordpress.org/ticket/58962">#58962</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesoptionphp">trunk/src/wp-includes/option.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsoptiongetOptionsphp">trunk/tests/phpunit/tests/option/getOptions.php</a></li>
<li><a href="#trunktestsphpunittestsoptionprimeOptionsphp">trunk/tests/phpunit/tests/option/primeOptions.php</a></li>
<li><a href="#trunktestsphpunittestsoptionprimeOptionsByGroupphp">trunk/tests/phpunit/tests/option/primeOptionsByGroup.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesoptionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/option.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/option.php 2023-08-24 14:33:28 UTC (rev 56444)
+++ trunk/src/wp-includes/option.php 2023-08-24 14:40:01 UTC (rev 56445)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -254,6 +254,117 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Primes specific options into the cache with a single database query.
+ *
+ * Only options that do not already exist in cache will be primed.
+ *
+ * @since 6.4.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param array $options An array of option names to be primed.
+ */
+function prime_options( $options ) {
+ $alloptions = wp_load_alloptions();
+ $cached_options = wp_cache_get_multiple( $options, 'options' );
+
+ // Filter options that are not in the cache.
+ $options_to_prime = array();
+ foreach ( $options as $option ) {
+ if ( ( ! isset( $cached_options[ $option ] ) || ! $cached_options[ $option ] ) && ! isset( $alloptions[ $option ] ) ) {
+ $options_to_prime[] = $option;
+ }
+ }
+
+ // Bail early if there are no options to be primed.
+ if ( empty( $options_to_prime ) ) {
+ return;
+ }
+
+ global $wpdb;
+ $results = $wpdb->get_results(
+ $wpdb->prepare(
+ sprintf(
+ "SELECT option_name, option_value FROM $wpdb->options WHERE option_name IN (%s)",
+ implode( ',', array_fill( 0, count( $options_to_prime ), '%s' ) )
+ ),
+ $options_to_prime
+ )
+ );
+
+ $options_found = array();
+ foreach ( $results as $result ) {
+ $options_found[ $result->option_name ] = maybe_unserialize( $result->option_value );
+ }
+ wp_cache_set_multiple( $options_found, 'options' );
+
+ // If all options were found, no need to update `notoptions` cache.
+ if ( count( $options_found ) === count( $options_to_prime ) ) {
+ return;
+ }
+
+ $options_not_found = array_diff( $options_to_prime, array_keys( $options_found ) );
+
+ $notoptions = wp_cache_get( 'notoptions', 'options' );
+
+ if ( ! is_array( $notoptions ) ) {
+ $notoptions = array();
+ }
+
+ // Add the options that were not found to the cache.
+ $update_notoptions = false;
+ foreach ( $options_not_found as $option_name ) {
+ if ( ! isset( $notoptions[ $option_name ] ) ) {
+ $notoptions[ $option_name ] = true;
+ $update_notoptions = true;
+ }
+ }
+
+ // Only update the cache if it was modified.
+ if ( $update_notoptions ) {
+ wp_cache_set( 'notoptions', $notoptions, 'options' );
+ }
+}
+
+/**
+ * Primes all options registered with a specific option group.
+ *
+ * @since 6.4.0
+ *
+ * @global array $new_allowed_options
+ *
+ * @param string $option_group The option group to prime options for.
+ */
+function prime_options_by_group( $option_group ) {
+ global $new_allowed_options;
+
+ if ( isset( $new_allowed_options[ $option_group ] ) ) {
+ prime_options( $new_allowed_options[ $option_group ] );
+ }
+}
+
+/**
+ * Retrieves multiple options.
+ *
+ * Options are primed as necessary first in order to use a single database query at most.
+ *
+ * @since 6.4.0
+ *
+ * @param array $options An array of option names to retrieve.
+ * @return array An array of key-value pairs for the requested options.
+ */
+function get_options( $options ) {
+ prime_options( $options );
+
+ $result = array();
+ foreach ( $options as $option ) {
+ $result[ $option ] = get_option( $option );
+ }
+
+ return $result;
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Protects WordPress special option from being modified.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Will die if $option is in protected list. Protected options are 'alloptions'
</span></span></pre></div>
<a id="trunktestsphpunittestsoptiongetOptionsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/option/getOptions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/getOptions.php (rev 0)
+++ trunk/tests/phpunit/tests/option/getOptions.php 2023-08-24 14:40:01 UTC (rev 56445)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,91 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Test get_options().
+ *
+ * @group option
+ *
+ * @covers ::get_options
+ */
+class Tests_Option_GetOptions extends WP_UnitTestCase {
+
+ /**
+ * Tests that get_options() retrieves specified options.
+ *
+ * @ticket 58962
+ */
+ public function test_get_options() {
+ // Create some options to prime.
+ $options_to_prime = array(
+ 'option1',
+ 'option2',
+ );
+
+ /*
+ * Set values for the options,
+ * clear the cache for the options,
+ * check options are not in cache initially.
+ */
+ foreach ( $options_to_prime as $option ) {
+ update_option( $option, "value_$option", false );
+ wp_cache_delete( $option, 'options' );
+ $this->assertFalse( wp_cache_get( $option, 'options' ), "$option was not deleted from the cache." );
+ }
+
+ // Call the get_options function to retrieve the options.
+ $options = get_options( array( 'option1', 'option2' ) );
+
+ // Check that options are now in the cache.
+ foreach ( $options_to_prime as $option ) {
+ $this->assertSame( wp_cache_get( $option, 'options' ), get_option( $option ), "$option was not primed." );
+ }
+
+ // Check that the retrieved options are correct.
+ $this->assertSame( get_option( 'option1' ), $options['option1'], 'Retrieved option1 does not match expected value.' );
+ $this->assertSame( get_option( 'option2' ), $options['option2'], 'Retrieved option2 does not match expected value.' );
+ }
+
+ /**
+ * Tests get_options() with an empty input array.
+ *
+ * @ticket 58962
+ */
+ public function test_get_options_with_empty_array() {
+ // Call the get_options function with an empty array.
+ $options = get_options( array() );
+
+ // Make sure the result is an empty array.
+ $this->assertIsArray( $options, 'An array should have been returned.' );
+ $this->assertEmpty( $options, 'No options should have been returned.' );
+ }
+
+ /**
+ * Tests get_options() with options that include some nonexistent options.
+ */
+ public function test_get_options_with_nonexistent_options() {
+ // Create some options to prime.
+ $options_to_prime = array(
+ 'option1',
+ );
+
+ // Make sure options are not in cache or database initially.
+ $this->assertFalse( wp_cache_get( 'option1', 'options' ), 'option1 was not deleted from the cache.' );
+ $this->assertFalse( wp_cache_get( 'nonexistent_option', 'options' ), 'nonexistent_option was not deleted from the cache.' );
+
+ // Call the get_options function with an array that includes a nonexistent option.
+ $options = get_options( array( 'option1', 'nonexistent_option' ) );
+
+ // Check that the retrieved options are correct.
+ $this->assertSame( get_option( 'option1' ), $options['option1'], 'Retrieved option1 does not match expected value.' );
+
+ // Check that options are present in the notoptions cache.
+ $new_notoptions = wp_cache_get( 'notoptions', 'options' );
+ foreach ( $options_to_prime as $option ) {
+ $this->assertTrue( isset( $new_notoptions[ $option ] ), "$option was not added to the notoptions cache." );
+ }
+
+ // Check that the nonexistent option is in the result array.
+ $this->assertArrayHasKey( 'nonexistent_option', $options, 'Result array should not contain nonexistent_option.' );
+
+ $this->assertFalse( $options['nonexistent_option'], 'nonexistent_option is present in option.' );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/option/getOptions.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunittestsoptionprimeOptionsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/option/primeOptions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/primeOptions.php (rev 0)
+++ trunk/tests/phpunit/tests/option/primeOptions.php 2023-08-24 14:40:01 UTC (rev 56445)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,130 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Test prime_options().
+ *
+ * @group option
+ *
+ * @covers ::prime_options
+ */
+class Tests_Option_PrimeOptions extends WP_UnitTestCase {
+
+ /**
+ * Tests that prime_options() primes multiple options.
+ *
+ * @ticket 58962
+ */
+ public function test_prime_options() {
+ // Create some options to prime.
+ $options_to_prime = array(
+ 'option1',
+ 'option2',
+ 'option3',
+ );
+
+ /*
+ * Set values for the options,
+ * clear the cache for the options,
+ * check options are not in cache initially.
+ */
+ foreach ( $options_to_prime as $option ) {
+ update_option( $option, "value_$option", false );
+ wp_cache_delete( $option, 'options' );
+ $this->assertFalse( wp_cache_get( $option, 'options' ), "$option was not deleted from the cache." );
+ }
+
+ // Call the prime_options function to prime the options.
+ prime_options( $options_to_prime );
+
+ // Store the initial database query count.
+ $initial_query_count = get_num_queries();
+
+ // Check that options are only in the 'options' cache group.
+ foreach ( $options_to_prime as $option ) {
+ $this->assertSame(
+ wp_cache_get( $option, 'options' ),
+ get_option( $option ),
+ "$option was not primed to the 'options' cache group."
+ );
+
+ $this->assertFalse(
+ wp_cache_get( $option, 'notoptions' ),
+ get_option( $option ),
+ "$option was primed to the 'notoptions' cache group."
+ );
+ }
+
+ // Ensure no additional database queries were made.
+ $this->assertSame(
+ $initial_query_count,
+ get_num_queries(),
+ 'Additional database queries were made.'
+ );
+ }
+
+ /**
+ * Tests prime_options() with options that do not exist in the database.
+ *
+ * @ticket 58962
+ */
+ public function test_prime_options_with_nonexistent_options() {
+ // Create some options to prime.
+ $options_to_prime = array(
+ 'option1',
+ 'option2',
+ );
+
+ /*
+ * Set values for the options,
+ * clear the cache for the options,
+ * check options are not in cache initially.
+ */
+ foreach ( $options_to_prime as $option ) {
+ $this->assertFalse( wp_cache_get( $option, 'options' ), "$option was not deleted from the cache." );
+ }
+
+ // Call the prime_options function to prime the options.
+ prime_options( $options_to_prime );
+
+ // Check that options are not in the cache or database.
+ foreach ( $options_to_prime as $option ) {
+ $this->assertFalse( wp_cache_get( $option, 'options' ), "$option was not deleted from the cache." );
+ }
+
+ // Check that options are present in the notoptions cache.
+ $new_notoptions = wp_cache_get( 'notoptions', 'options' );
+ $this->assertIsArray( $new_notoptions, 'The notoptions cache should be an array.' );
+ foreach ( $options_to_prime as $option ) {
+ $this->assertArrayHasKey( $option, $new_notoptions, "$option was not added to the notoptions cache." );
+ }
+ }
+
+ /**
+ * Tests prime_options() with an empty array.
+ *
+ * @ticket 58962
+ */
+ public function test_prime_options_with_empty_array() {
+ $alloptions = wp_load_alloptions();
+ $notoptions = wp_cache_get( 'notoptions', 'options' );
+
+ prime_options( array() );
+
+ $this->assertSame( $alloptions, wp_cache_get( 'alloptions', 'options' ), 'The alloptions cache was modified.' );
+ $this->assertSame( $notoptions, wp_cache_get( 'notoptions', 'options' ), 'The notoptions cache was modified.' );
+ }
+
+ /**
+ * Tests that prime_options handles an empty "notoptions" cache.
+ *
+ * @ticket 58962
+ */
+ public function test_prime_options_handles_empty_notoptions_cache() {
+ wp_cache_delete( 'notoptions', 'options' );
+
+ prime_options( array( 'nonexistent_option' ) );
+
+ $notoptions = wp_cache_get( 'notoptions', 'options' );
+ $this->assertIsArray( $notoptions, 'The notoptions cache should be an array.' );
+ $this->assertArrayHasKey( 'nonexistent_option', $notoptions, 'nonexistent_option was not added to notoptions.' );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/option/primeOptions.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunittestsoptionprimeOptionsByGroupphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/option/primeOptionsByGroup.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/primeOptionsByGroup.php (rev 0)
+++ trunk/tests/phpunit/tests/option/primeOptionsByGroup.php 2023-08-24 14:40:01 UTC (rev 56445)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,75 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Test prime_options_by_group().
+ *
+ * @group option
+ *
+ * @covers ::prime_options_by_group
+ */
+class Tests_Option_PrimeOptionsByGroup extends WP_UnitTestCase {
+
+ /**
+ * Tests that prime_options_by_group() only primes options in the specified group.
+ *
+ * @ticket 58962
+ */
+ public function test_prime_options_by_group() {
+ global $new_allowed_options;
+
+ // Create some options to prime.
+ $new_allowed_options = array(
+ 'group1' => array(
+ 'option1',
+ 'option2',
+ ),
+ 'group2' => array(
+ 'option3',
+ ),
+ );
+
+ $options_to_prime = array(
+ 'option1',
+ 'option2',
+ 'option3',
+ );
+
+ /*
+ * Set values for the options,
+ * clear the cache for the options,
+ * check options are not in cache initially.
+ */
+ foreach ( $options_to_prime as $option ) {
+ update_option( $option, "value_$option", false );
+ wp_cache_delete( $option, 'options' );
+ $this->assertFalse( wp_cache_get( $option, 'options' ), "$option was not deleted from the cache." );
+ }
+
+ // Call the prime_options_by_group function to prime the options.
+ prime_options_by_group( 'group1' );
+
+ // Check that options are now in the cache.
+ $this->assertSame( get_option( 'option1' ), wp_cache_get( 'option1', 'options' ), 'option1 was not primed.' );
+ $this->assertSame( get_option( 'option2' ), wp_cache_get( 'option2', 'options' ), 'option2 was not primed.' );
+
+ // Make sure option3 is still not in cache.
+ $this->assertFalse( wp_cache_get( 'option3', 'options' ), 'option3 was not deleted from the cache.' );
+ }
+
+ /**
+ * Tests prime_options_by_group() with a nonexistent option group.
+ *
+ * @ticket 58962
+ */
+ public function test_prime_options_by_group_with_nonexistent_group() {
+ // Make sure options are not in cache or database initially.
+ $this->assertFalse( wp_cache_get( 'option1', 'options' ), 'option1 was not deleted from the cache.' );
+ $this->assertFalse( wp_cache_get( 'option2', 'options' ), 'option2 was not deleted from the cache.' );
+
+ // Call the prime_options_by_group function with a nonexistent group.
+ prime_options_by_group( 'nonexistent_group' );
+
+ // Check that options are still not in the cache or database.
+ $this->assertFalse( wp_cache_get( 'option1', 'options' ), 'option1 was not deleted from the cache.' );
+ $this->assertFalse( wp_cache_get( 'option2', 'options' ), 'option2 was not deleted from the cache.' );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/option/primeOptionsByGroup.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span></div>
</body>
</html>