Skip to content

Commit 5163cf7

Browse files
dev: trigger activity log on deactivation
1 parent 7f68abd commit 5163cf7

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

includes/abstract/feedzy-rss-feeds-admin-abstract.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function get_usage_data( $data ) {
8686
$categories = count( $terms );
8787
}
8888
// imports.
89-
$imports = array();
9089
$license = 'free';
9190

9291
$imports = array(
@@ -163,8 +162,10 @@ public function get_usage_data( $data ) {
163162
'license' => $license,
164163
);
165164

166-
$settings = apply_filters( 'feedzy_get_settings', null );
167-
$config = array();
165+
$settings = apply_filters( 'feedzy_get_settings', null );
166+
$general_settings = array();
167+
$config = array();
168+
168169
if ( $settings ) {
169170
$proxy = isset( $settings['proxy'] ) && is_array( $settings['proxy'] ) && ! empty( $settings['proxy'] ) ? array_filter( $settings['proxy'] ) : array();
170171
if ( ! empty( $proxy ) ) {

includes/admin/feedzy-rss-feeds-usage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class Feedzy_Rss_Feeds_Usage {
3636
* @var array
3737
*/
3838
private $default_data = array(
39-
'first_import_run_datetime' => null,
39+
'first_import_run_datetime' => '',
4040
'imports_runs' => 0,
41-
'first_import_created_datetime' => null,
41+
'first_import_created_datetime' => '',
4242
);
4343

4444
/**

includes/feedzy-rss-feeds-deactivator.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ class Feedzy_Rss_Feeds_Deactivator {
3030
* @access public
3131
*/
3232
public static function deactivate() {
33+
self::try_send_logs();
3334
delete_option( 'feedzy-activated' );
3435
}
36+
37+
/**
38+
* Send the logs with the plugin usage if telemetry is active.
39+
*
40+
* @return void
41+
*/
42+
public static function try_send_logs() {
43+
if ( 'yes' !== get_option( 'feedzy_rss_feeds_logger_flag' ) ) {
44+
return;
45+
}
46+
47+
do_action( 'feedzy_rss_feeds_log_activity' );
48+
}
3549
}

0 commit comments

Comments
 (0)