-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathExtension_AlwaysCached_Page_View_BoxQueue.php
129 lines (124 loc) · 4.35 KB
/
Extension_AlwaysCached_Page_View_BoxQueue.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* File: Extension_AlwaysCached_Page_ViewBoxQueue.php
*
* Render the AlwaysCached settings page - queue box.
*
* @since 2.8.0
*
* @package W3TC
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
$c = Dispatcher::config();
$pgcache_disabled = ! $c->get_boolean( 'pgcache.enabled' );
$count_pending = Extension_AlwaysCached_Queue::row_count_pending();
$count_postponed = Extension_AlwaysCached_Queue::row_count_postponed();
$time_lastrun = get_option( 'w3tc_alwayscached_worker_timestamp' );
?>
<div class="metabox-holder">
<?php Util_Ui::postbox_header( esc_html__( 'Queue', 'w3-total-cache' ), '', 'queue' ); ?>
<p>
<?php esc_html_e( 'The "Pending in queue" represent pages/posts that have been updated but are still serving the pre-update cache entry.', 'w3-total-cache' ); ?>
</p>
<p>
<?php esc_html_e( 'The "Postponed in queue" represent pages/posts that failed to process either due to an error or due to the queue processor exceeding its allocated time slot. These entries will be processed on the next scheduled queue processor execution.', 'w3-total-cache' ); ?>
</p>
<p>
<?php esc_html_e( 'The "Last processed" represents the last time the queue processor was executed.', 'w3-total-cache' ); ?>
</p>
<p>
<?php esc_html_e( 'When viewing the queue, each entry will have a circular arrow icon that can be clicked to manually regenerate the corresponding cache entry. Once this completes, the queue entry will be removed from the queue.', 'w3-total-cache' ); ?>
</p>
<table class="form-table">
<tr>
<th style="width: 300px;">
<label>
<?php esc_html_e( 'Pending in queue:', 'w3-total-cache' ); ?>
</label>
</th>
<td>
<?php echo esc_html( $count_pending ); ?>
<?php if ( $count_pending > 0 ) : ?>
<a href="#" class="w3tc-alwayscached-queue" data-mode="pending">
<?php esc_html_e( 'View', 'w3-total-cache' ); ?>
</a>
<section class="w3tc-alwayscached-queue-section"></section>
<?php endif ?>
</td>
</tr>
<tr>
<th>
<label>
<?php esc_html_e( 'Postponed in queue:', 'w3-total-cache' ); ?>
</label>
</th>
<td>
<?php echo esc_html( $count_postponed ); ?>
<?php if ( $count_postponed > 0 ) : ?>
<a href="#" class="w3tc-alwayscached-queue" data-mode="postponed">
<?php esc_html_e( 'View', 'w3-total-cache' ); ?>
</a>
<section class="w3tc-alwayscached-queue-section"></section>
<?php endif ?>
</td>
</tr>
<tr>
<th>
<label>
<?php esc_html_e( 'Last processed:', 'w3-total-cache' ); ?>
</label>
</th>
<td>
<?php
if ( empty( $time_lastrun ) ) {
esc_html_e( 'n/a', 'w3-total-cache' );
} else {
echo wp_kses(
sprintf(
// translators: 1 opening HTML span tag, 2 last queue run time, 3 closing HTML span tag.
__(
'%1$s%2$s ago%3$s',
'w3-total-cache'
),
'<span title="' . esc_html( $time_lastrun ) . '">',
esc_html( human_time_diff( strtotime( $time_lastrun ), time() ) ),
'</span>'
),
array(
'span' => array(
'title' => array(),
),
)
);
}
?>
</td>
</tr>
<tr>
<th></th>
<td>
<input id="w3tc-alwayscached-process" type="submit" name="w3tc_alwayscached_process"
value="<?php esc_html_e( 'Regenerate All', 'w3-total-cache' ); ?>" class="button" <?php echo $pgcache_disabled ? 'disabled="disabled"' : ''; ?>/>
<p>
<?php esc_html_e( 'This button will manually trigger the queue processor to begin regenerating the cache entry for each item in the queue, thereby publishing all pending changes.', 'w3-total-cache' ); ?>
</p>
</td>
</tr>
<tr>
<th></th>
<td>
<input id="w3tc-alwayscached-empty" type="submit" name="w3tc_alwayscached_empty"
value="<?php esc_html_e( 'Clear Queue', 'w3-total-cache' ); ?>" class="button" <?php echo $pgcache_disabled ? 'disabled="disabled"' : ''; ?>/>
<p>
<?php esc_html_e( 'This button removes all items in the queue. The pending changes for each removed item will not be published until the corresponding existing cache entry expires. Removed items can be re-added to the queue via further modifications to the item or a flush all caches operation with the "Queue Purge All Requests" option enabled.', 'w3-total-cache' ); ?>
</p>
</td>
</tr>
</table>
<?php Util_Ui::postbox_footer(); ?>
</div>