self::PHASE_WAITING, 'started_at' => time(), ] ); update_option( self::OPTION, $state, false ); } /** * Merge fields into the current in-flight test. * * @since 4.10.0 * * @param array $fields The fields to overwrite; anything already stored * and not named here is left as is. */ public static function update( array $fields ) { $state = self::get(); // Never create state here. A reset that lands between another request's // read and its write would otherwise resurrect the test it just cleared. if ( $state === null ) { return; } update_option( self::OPTION, array_merge( $state, $fields ), false ); } /** * Clear the in-flight test entirely. * * @since 4.10.0 */ public static function clear() { delete_option( self::OPTION ); } }