PluginProbe
Docket Cache – Object Cache Accelerator / 24.07.06
Docket Cache – Object Cache Accelerator v24.07.06
26.04.05 trunk 22.07.01 22.07.02 22.07.03 22.07.04 22.07.05 23.08.01 23.08.02 24.07.01 24.07.02 24.07.03 24.07.04 24.07.05 24.07.06 24.07.07 26.04.03 26.04.04
docket-cache / includes / admin / cronbot.php

cronbot.php in Docket Cache – Object Cache Accelerator 24.07.06, at includes/admin/cronbot.php

146 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Docket Cache.
4 *
5 * @author Nawawi Jamili
6 * @license MIT
7 *
8 * @see https://github.com/nawawi/docket-cache
9 */
10
11 namespace Nawawi\DocketCache;
12
13 \defined('ABSPATH') || exit;
14 $event_list = $this->cronbot_eventlist();
15 if (\is_object($event_list)) :
16 $utc_offset = '('.$this->pt->get_utc_offset().')';
17 $total_page = $event_list->get_pagination_arg('total_pages');
18
19 $is_connected = $this->is_cronbot_connected();
20 $ping_last = esc_html__('Not Available', 'docket-cache');
21 $ping_next = $ping_last;
22 $ping_data = $this->ping_next();
23 if (!empty($ping_data)) :
24 $ping_next = $ping_data['next'].' '.$utc_offset;
25 $ping_last = $ping_data['last'].' '.$utc_offset;
26 endif;
27 endif;
28 ?>
29 <div class="section cronbot">
30 <div class="flex-container">
31 <div class="row">
32 <?php $this->tab_title(esc_html__('Cronbot', 'docket-cache')); ?>
33 <?php
34 if (!\is_object($event_list)) :
35 echo Resc::boxmsg(__('Failed to load EventList()', 'docket-cache'), 'error', false, true, false);
36 else :
37 ?>
38 <table class="form-table">
39 <tr>
40 <th><?php esc_html_e('Service Status', 'docket-cache'); ?></th>
41 <td class="<?php echo $is_connected ? 'text-green' : 'text-red'; ?>"><?php echo $is_connected ? esc_html__('Connected', 'docket-cache') : esc_html__('Not Connected', 'docket-cache'); ?></td>
42 </tr>
43
44 <tr>
45 <th><?php esc_html_e('Last Received Ping', 'docket-cache'); ?></th>
46 <td><?php echo $ping_last; ?></td>
47 </tr>
48 <?php if ($is_connected) : ?>
49 <tr>
50 <th><?php esc_html_e('Next Expecting Ping', 'docket-cache'); ?></th>
51 <td><?php echo $ping_next; ?></td>
52 </tr>
53 <?php endif; ?>
54 </table>
55
56 <p class="submit">
57 <?php if ($is_connected) : ?>
58 <a href="<?php echo $this->pt->action_query('disconnect-cronbot', ['idx' => 'cronbot']); ?>" class="button button-secondary button-large btx-spinner"><?php esc_html_e('Disconnect', 'docket-cache'); ?></a>
59 <a href="<?php echo $this->pt->action_query('pong-cronbot', ['idx' => 'cronbot']); ?>" class="button button-secondary button-large btx-spinner"><?php esc_html_e('Test Ping', 'docket-cache'); ?></a>
60 <?php else : ?>
61 <a href="<?php echo $this->pt->action_query('connect-cronbot', ['idx' => 'cronbot']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Connect', 'docket-cache'); ?></a>
62 <?php endif; ?>
63 </p>
64
65 <?php $this->tab_title(esc_html__('Cron Events', 'docket-cache'), 'title-below'); ?>
66 <table class="form-table">
67 <?php
68 $title = esc_html__('Cron Events For Site', 'docket-cache');
69 $sites = $this->pt->get_network_sites();
70 if (is_multisite() && !empty($sites) && \is_array($sites) && \count($sites) > 1) :
71 ?>
72 <tr class="form-table-selection">
73 <th><?php echo $title; ?></th>
74 <td><select id="siteid" class="config-select">
75 <?php
76 $cronbot_siteid = (int) $this->pt->get_cron_siteid();
77
78 foreach ($sites as $site) {
79 $site_id = (int) $site['id'];
80 $site_url = $site['url'];
81 $v = '['.$site_id.'] '.nwdcx_noscheme($site_url);
82 $url = $this->pt->action_query(
83 'selectsite-cronbot',
84 [
85 'idx' => 'cronbot',
86 'nv' => $site_id,
87 ]
88 );
89 $selected = $site_id === $cronbot_siteid ? ' selected' : '';
90 echo '<option value="'.$site_id.'" data-action-link="'.$url.'"'.$selected.'>'.$v.'</option>';
91 }
92 ?>
93 </select>
94 <small>[SiteId] Hostname</small>
95 </td>
96 </tr>
97 <?php else : ?>
98 <tr>
99 <th><?php echo $title; ?></th>
100 <td><?php echo nwdcx_noscheme(home_url()); ?></td>
101 </tr>
102 <?php endif; ?>
103 </table>
104 <div class="gridlist">
105
106 <div class="box-left">
107 <a href="
108 <?php
109 echo $this->pt->action_query(
110 'runevent-cronbot',
111 [
112 'idx' => 'cronbot',
113 ]
114 );
115 ?>
116 " class="button button-secondary button-large btx-spinner"><?php esc_html_e('Run Scheduled Event', 'docket-cache'); ?></a>
117 <a href="
118 <?php
119 echo $this->pt->action_query(
120 'runeventnow-cronbot',
121 [
122 'idx' => 'cronbot',
123 ]
124 );
125 ?>
126 " class="button button-secondary button-large btx-spinner"><?php esc_html_e('Run All Now', 'docket-cache'); ?></a>
127 </div>
128
129 <?php if ($total_page > 1 || !empty($_GET['s'])) : ?>
130 <div class="box-right">
131 <form id="events-filter" method="get" action="<?php echo esc_url($this->pt->get_page()); ?>">
132 <input type="hidden" name="page" value="docket-cache">
133 <input type="hidden" name="idx" value="cronbot">
134 <?php $event_list->search_box(__('Filter Hook Names', 'docket-cache'), 'eventlist-event'); ?>
135 </form>
136 </div>
137 <?php endif; ?>
138 <div class="table-responsive">
139 <?php $event_list->display(); ?>
140 </div>
141 </div>
142 <?php endif; // is_object?>
143 </div>
144 </div>
145 </div>
146