-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.phtml
163 lines (160 loc) · 5.14 KB
/
configure.phtml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<form action="<?php echo _url('extension', 'configure', 'e', urlencode($this->getName())); ?>" method="post">
<input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" />
<div class="form-group">
<label class="group-name" for="auto_ttl_max_ttl">Max TTL</label>
<div class="group-controls">
<select class="w50" name="auto_ttl_max_ttl" id="auto_ttl_max_ttl" required="required">
<?php foreach (
[
1200 => '20min',
1500 => '25min',
1800 => '30min',
2700 => '45min',
3600 => '1h',
5400 => '1.5h',
7200 => '2h',
10800 => '3h',
14400 => '4h',
18800 => '5h',
21600 => '6h',
25200 => '7h',
28800 => '8h',
36000 => '10h',
43200 => '12h',
64800 => '18h',
86400 => '1d',
129600 => '1.5d',
172800 => '2d',
259200 => '3d',
345600 => '4d',
432000 => '5d',
518400 => '6d',
604800 => '1wk',
1209600 => '2wk',
1814400 => '3wk',
2419200 => '4wk',
2629744 => '1mo',
] as $v => $t
) {
echo '<option value="'.
$v.
($this->maxTTL === $v ? '" selected="selected' : '').
'">'.
$t.
'</option>';
} ?>
</select>
</div>
<label class="group-name" for="auto_ttl_stats_count">Statistics table rows</label>
<div class="group-controls">
<input type="number" min="1" value="<?php echo $this->statsCount; ?>" class="w50" name="auto_ttl_stats_count" id="auto_ttl_stats_count" required="required" />
</div>
</div>
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
<button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button>
</div>
</div>
</form>
<?php
$now = time();
?>
<div class="table-wrapper">
<h2>Feeds using AutoTTL</h2>
<table>
<thead>
<th>Feed</th>
<th>Average TTL</th>
<th>Status</th>
<th>Adjusted update TTL</th>
<th>Last update</th>
<th>Time until next update</th>
</thead>
<tbody>
<?php foreach ($this->getStats()->getFeedStats(true) as $feed) { ?>
<?php $adjustedTTL = $this->getStats()->calcAdjustedTTL($feed->avgTTL, $feed->dateMax); ?>
<tr>
<td>
<a class="configure" target="_blank" href="<?= _url('subscription', 'feed', 'id', $feed->id) ?>" title="<?= _t('gen.action.manage') ?>"><?= _i('configure') ?></a>
<?= htmlspecialchars($feed->name, ENT_NOQUOTES, 'UTF-8') ?>
</td>
<td>
<?= ($feed->avgTTL > 0) ? $this->getStats()->humanIntervalFromSeconds($feed->avgTTL) : 'no items' ?>
</td>
<td>
<?= $feed->isActive($now) ? 'active' : 'idle' ?>
</td>
<td>
<?= $this->getStats()->humanIntervalFromSeconds($adjustedTTL) ?>
</td>
<td>
<?= ($feed->lastUpdate > 0) ? $this->getStats()->humanIntervalFromSeconds($now - $feed->lastUpdate).' ago' : 'never' ?>
</td>
<td>
<?php
if ($feed->lastUpdate > 0) {
$timeUntil = $feed->lastUpdate + $adjustedTTL - $now;
if ($timeUntil > 0) {
$interval = $this->getStats()->humanIntervalFromSeconds($timeUntil);
echo $interval;
} else {
echo 'pending';
}
} else {
echo 'never updated';
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="table-wrapper">
<h2>Feeds not using AutoTTL</h2>
<p>To enable AutoTTL for a feed, configure the feed's "Do not automatically refresh more often than" option to "By default".</p>
<table>
<thead>
<th>Feed</th>
<th>Average TTL</th>
<th>Update TTL</th>
<th>Last update</th>
<th>Time until next update</th>
</thead>
<tbody>
<?php foreach ($this->getStats()->getFeedStats(false) as $feed) { ?>
<tr>
<td>
<a class="configure" target="_blank" href="<?= _url('subscription', 'feed', 'id', $feed->id) ?>" title="<?= _t('gen.action.manage') ?>"><?= _i('configure') ?></a>
<?= htmlspecialchars($feed->name, ENT_NOQUOTES, 'UTF-8') ?>
</td>
<td>
<?= ($feed->avgTTL > 0) ? $this->getStats()->humanIntervalFromSeconds($feed->avgTTL) : 'no items' ?>
</td>
<td>
<?= $this->getStats()->humanIntervalFromSeconds($feed->ttl) ?>
</td>
<td>
<?= ($feed->lastUpdate > 0) ? $this->getStats()->humanIntervalFromSeconds($now - $feed->lastUpdate).' ago' : 'never' ?>
</td>
<td>
<?php
if ($feed->lastUpdate > 0) {
$timeUntil = $feed->lastUpdate + $feed->ttl - $now;
if ($timeUntil > 0) {
$interval = $this->getStats()->humanIntervalFromSeconds($timeUntil);
echo $interval;
} else {
echo 'pending';
}
} else {
echo 'never updated';
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>