-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Remove old records #1076
Closed
Closed
Fix: Remove old records #1076
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e98850c
Don’t restrict where the purge can run
kasparsd 15128b1
This should depend on the plugin state instead
kasparsd 64f4ac3
Use the helper for fetching the plugin settings
kasparsd e67e1ee
Describe why we might bail early
kasparsd 85b1815
Introduce helpers for getting certain settings
kasparsd 342e664
Use the new helpers instead
kasparsd 9418eff
Simplify the timestamp offset generation
kasparsd 69e0906
Per coding standards
kasparsd 3444d85
Use the API instead
kasparsd 2336970
This is already handled by the methods calling is_plugin_active_for_n…
kasparsd d874487
Use the API in tests too
kasparsd 58bf268
Test that fresh records are still there
kasparsd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,13 +270,7 @@ public function add_display_name_search_columns( $search_columns, $search, $quer | |
public function get_option_key() { | ||
$option_key = $this->option_key; | ||
|
||
$current_page = wp_stream_filter_input( INPUT_GET, 'page' ); | ||
|
||
if ( ! $current_page ) { | ||
$current_page = wp_stream_filter_input( INPUT_GET, 'action' ); | ||
} | ||
|
||
if ( 'wp_stream_network_settings' === $current_page ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the network settings if the plugin is network-activated. Is there a situation we would like to use network settings when the plugin is not network activated? |
||
if ( $this->plugin->is_network_activated() ) { | ||
$option_key = $this->network_options_key; | ||
} | ||
|
||
|
@@ -1167,4 +1161,38 @@ public function get_settings_translations( $labels ) { | |
|
||
return $labels; | ||
} | ||
|
||
/** | ||
* Get the record TTL sanitized. | ||
* | ||
* @return integer|null Returns the time-to-live in seconds or null if empty or not set. | ||
*/ | ||
public function records_ttl() { | ||
$options = $this->get_options(); | ||
|
||
if ( isset( $options['general_records_ttl'] ) ) { | ||
$ttl = abs( $options['general_records_ttl'] ); | ||
|
||
if ( $ttl > 0 ) { | ||
return $ttl; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* Should the records be stored indefinitely. | ||
* | ||
* @return boolean | ||
*/ | ||
public function keep_records_indefinitely() { | ||
$options = $this->get_options(); | ||
|
||
if ( ! empty( $options['general_keep_records_indefinitely'] ) ) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why
is_network_admin()
would need to be checked on cron runs.