Skip to content

Commit 8ee0e4c

Browse files
committed
revert: don't disable by default / update db
1 parent 8ab4aa4 commit 8ee0e4c

File tree

3 files changed

+0
-50
lines changed

3 files changed

+0
-50
lines changed

activation.php

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,6 @@ function graphql_activation_callback() {
1212
return;
1313
}
1414

15-
// Run any activation scripts before updating the version.
16-
graphql_migrate_1_20_0();
17-
1815
// store the current version of WPGraphQL
1916
update_option( 'wp_graphql_version', WPGRAPHQL_VERSION );
2017
}
21-
22-
23-
/**
24-
* Handles compatibility when updating from pre-v1.20.0 versions of WPGraphQL.
25-
*
26-
* @todo Remove this function in v2.0.0, when the default value for `query_analyzer_enabled` is set to `true`.
27-
*/
28-
function graphql_migrate_1_20_0(): void {
29-
// If the version is already set, we don't need to do anything.
30-
$version = get_option( 'wp_graphql_version' );
31-
if ( ! $version ) {
32-
return;
33-
}
34-
35-
// If the previous version is higher than 1.20.0, we don't need to do anything.
36-
if ( version_compare( $version, '1.20.0', '>=' ) ) {
37-
return;
38-
}
39-
40-
/**
41-
* Set `query_analyzer_enabled` to `true` for preexisting installs.
42-
*
43-
* This is to prevent breaking changes in caching solutions that rely on the Query Analyzer, but aren't insuring that the `graphql_should_analyze_queries` filter is set to true.
44-
*/
45-
46-
$graphql_settings = get_option( 'graphql_general_settings', [] );
47-
48-
$graphql_settings['query_analyzer_enabled'] = 'on';
49-
50-
update_option( 'graphql_general_settings', $graphql_settings );
51-
}

src/Admin/Settings/Settings.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ public function register_settings() {
173173
true === \WPGraphQL::debug() ? '<br /><strong>' . __( 'NOTE: This setting is force enabled because GraphQL Debug Mode is enabled. ', 'wp-graphql' ) . '</strong>' : ''
174174
),
175175
'type' => 'checkbox',
176-
'default' => 'off',
177176
'disabled' => true === \WPGraphQL::debug(),
178177
'value' => true === \WPGraphQL\Utils\QueryAnalyzer::is_enabled() ? 'on' : get_graphql_setting( 'query_analyzer_enabled', 'off' ),
179178
],

tests/wpunit/QueryAnalyzerTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
use WPGraphQL\Utils\QueryAnalyzer;
44

5-
use function Codeception\Extension\codecept_log;
6-
75
class QueryAnalyzerTest extends \Tests\WPGraphQL\TestCase\WPGraphQLTestCase {
86

97
public $post_id;
@@ -51,19 +49,6 @@ public function testEnableQueryAnalyzer(): void {
5149

5250
$query = '{ posts { nodes { id, title } } }';
5351

54-
/** Test default behavior */
55-
$this->toggle_query_analyzer( null );
56-
$actual = QueryAnalyzer::is_enabled();
57-
$this->assertFalse( $actual, 'Query Analyzer should be disabled by default' );
58-
59-
$request = graphql( ['query' => $query ], true );
60-
$actual_response = $request->execute();
61-
$actual_analyzer = $request->get_query_analyzer();
62-
63-
$this->assertFalse( $actual_analyzer->is_enabled(), 'Query Analyzer should be disabled by default' );
64-
$this->assertFalse( $actual_analyzer->is_enabled_for_query(), 'Query Analyzer should be disabled for query' );
65-
$this->assertArrayNotHasKey( 'queryAnalyzer', $actual_response['extensions'], 'There should be no extension output if Query Analyzer is disabled ' );
66-
6752
/** Test with Query Analyzer toggled on */
6853
$this->toggle_query_analyzer( true );
6954
$actual = QueryAnalyzer::is_enabled();

0 commit comments

Comments
 (0)