Skip to content

Commit

Permalink
Remove DataTables cache settings
Browse files Browse the repository at this point in the history
These should be added to DataTables instead
  • Loading branch information
mrcasual committed Feb 19, 2024
1 parent cdf28d2 commit 6eefc23
Showing 2 changed files with 2 additions and 25 deletions.
25 changes: 1 addition & 24 deletions future/includes/class-gv-settings-plugin.php
Original file line number Diff line number Diff line change
@@ -195,7 +195,6 @@ public function defaults() {
'public_entry_moderation' => 0,
'caching' => 1,
'caching_entries' => DAY_IN_SECONDS,
'caching_datatables_output' => DAY_IN_SECONDS,
);

/**
@@ -241,10 +240,6 @@ public function add_settings( $plugins_data ) {
$cache_filters_in_use[] = 'gravityview_cache_time_entries';
}

if ( has_filter( 'gravityview_cache_time_datatables_output' ) ) {
$cache_filters_in_use[] = 'gravityview_cache_time_datatables_output';
}

$cache_settings = [];

if ( ! empty( $cache_filters_in_use ) ) {
@@ -291,7 +286,7 @@ public function add_settings( $plugins_data ) {
'type' => 'checkbox',
'title' => esc_html__( 'Enable Caching', 'gk-gravityview' ),
'description' => strtr(
esc_html_x( '[url]Enabling caching[/url] improves performance by reducing the number of queries during page loads. When enabled, you can also specify cache duration for entries and DataTables output.', 'Placeholders inside [] are not to be translated.', 'gk-gravityview' ),
esc_html_x( '[url]Enabling caching[/url] improves performance by reducing the number of queries during page loads. When enabled, you can also specify cache duration for entries.', 'Placeholders inside [] are not to be translated.', 'gk-gravityview' ),
[
'[url]' => '<a class="underline" href="https://docs.gravitykit.com/article/58-about-gravityview-caching" rel="noopener noreferrer">',
'[/url]' => '</a>',
@@ -317,24 +312,6 @@ public function add_settings( $plugins_data ) {
'description' => esc_html__( 'Specify the duration in seconds that entry data should remain cached before being refreshed. A shorter duration ensures more up-to-date data, while a longer duration improves performance.', 'gk-gravityview' ),
'value' => $this->get( 'caching_entries', $default_settings['caching_entries'] ),
),
array(
'id' => 'caching_datatables_output',
'type' => 'number',
'requires' => array(
'id' => 'caching',
'operator' => '==',
'value' => 1,
),
'validation' => array(
array(
'rule' => 'min:1',
'message' => esc_html__( 'The cache duration must be at least 1 second.', 'gk-gravityview' ),
),
),
'title' => esc_html__( 'DataTables Cache Duration', 'gk-gravityview' ),
'description' => esc_html__( 'Define the cache lifetime in seconds for DataTables output. Adjusting this setting can balance between performance gains and data currency for your DataTables Views.', 'gk-gravityview' ),
'value' => $this->get( 'caching_datatables_output', $default_settings['caching_datatables_output'] ),
)
]
);

2 changes: 1 addition & 1 deletion tests/unit-tests/GravityView_Future_Test.php
Original file line number Diff line number Diff line change
@@ -5942,7 +5942,7 @@ public function test_plugin_settings() {
$settings->update( array() );

$this->assertSame( \GravityView_Settings::get_instance(), $settings );
$this->assertEquals( array_keys( $settings->defaults() ), array( 'rest_api', 'public_entry_moderation', 'caching', 'caching_entries', 'caching_datatables_output' ) );
$this->assertEquals( array_keys( $settings->defaults() ), array( 'rest_api', 'public_entry_moderation', 'caching', 'caching_entries' ) );

$this->assertNull( $settings->get( 'not' ) );
$this->assertEquals( $settings->get( 'not', 'default' ), 'default' );

0 comments on commit 6eefc23

Please sign in to comment.