Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions flywp.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ public function activate() {
}

/**
* Plugin activation hook.
* Plugin deactivation hook.
*
* @return void
*/
public function deactivate() {
( new FlyWP\Api\UpdatesData() )->deactivate();
$timestamp = wp_next_scheduled( FlyWP\Api\UpdatesData::CRON_HOOK );
if ( $timestamp ) {
wp_unschedule_event( $timestamp, FlyWP\Api\UpdatesData::CRON_HOOK );
}
}

/**
Expand Down
16 changes: 2 additions & 14 deletions includes/Api/UpdatesData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace FlyWP\Api;

use WP_Error;

class UpdatesData {
private const CRON_HOOK = 'flywp_send_updates_data';
private const CRON_INTERVAL = 'twicedaily';
public const CRON_HOOK = 'flywp_send_updates_data';
public const CRON_INTERVAL = 'twicedaily';

/**
* UpdatesData constructor.
Expand Down Expand Up @@ -236,14 +234,4 @@ private function load_required_files(): void {
require_once ABSPATH . 'wp-admin/includes/update.php';
}
}

/**
* Deactivate the scheduler when the plugin is deactivated.
*/
public function deactivate(): void {
$timestamp = wp_next_scheduled( self::CRON_HOOK );
if ( $timestamp ) {
wp_unschedule_event( $timestamp, self::CRON_HOOK );
}
}
}