-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathInitialize.php
More file actions
26 lines (21 loc) · 793 Bytes
/
Copy pathInitialize.php
File metadata and controls
26 lines (21 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
namespace CryptAPI;
require_once 'controllers/CryptAPI.php';
class Initialize {
public function initialize()
{
add_action('init', [$this, 'schedule_cron_job']);
}
public function schedule_cron_job()
{
$scheduled = wp_get_schedule('cryptapi_cronjob');
// Ensure the cron runs on the frequent CryptAPI interval so the order
// cancellation timeout is honoured promptly. Also migrates installs
// that ended up on a different schedule (e.g. an 'hourly' build) back
// to it, and (re)schedules if it was cleared.
if ($scheduled !== 'cryptapi_interval') {
wp_clear_scheduled_hook('cryptapi_cronjob');
wp_schedule_event(time(), 'cryptapi_interval', 'cryptapi_cronjob');
}
}
}