@@ -21,7 +21,7 @@ class ProcessWireUpgrade extends Process {
21
21
return array(
22
22
'title' => 'Upgrades',
23
23
'summary' => 'Tool that helps you identify and install core and module upgrades.',
24
- 'version' => 9 ,
24
+ 'version' => 10 ,
25
25
'author' => 'Ryan Cramer',
26
26
'installs' => 'ProcessWireUpgradeCheck',
27
27
'requires' => 'ProcessWire>=3.0.0',
@@ -180,14 +180,15 @@ class ProcessWireUpgrade extends Process {
180
180
181
181
$lastRefresh = $this->session->getFor($this, 'lastRefresh');
182
182
183
- if(!$lastRefresh && method_exists($this->modules, 'resetCache' )) {
183
+ if(!$lastRefresh || $lastRefresh < (time() - 86400 )) {
184
184
$btn = $this->refreshButton();
185
185
$btn->value = $this->_('Continue');
186
186
$btn->icon = 'angle-right';
187
187
return
188
- $this->h('We need to load the latest core and module versions from the ProcessWire modules directory.') .
189
- $this->p('This may take a few seconds to complete. Please click the button below to continue.') .
190
- $this->p($btn->render());
188
+ $this->h('We will load the latest core and module versions from the ProcessWire modules directory.') .
189
+ $this->p('Please be patient, this may take a few seconds to complete.') .
190
+ $this->p($btn->render()) .
191
+ $this->lastRefreshInfo();
191
192
}
192
193
193
194
return '';
@@ -223,9 +224,8 @@ class ProcessWireUpgrade extends Process {
223
224
224
225
if(count($items)) {
225
226
foreach($items as $name => $item) {
226
- if(empty($item['remote'])) {
227
- // not in directory
228
- }
227
+ if(empty($item['local'])) continue;
228
+ if(empty($item['remote'])) { /* not in directory */ }
229
229
230
230
$remote = $sanitizer->entities($item['remote']);
231
231
$installer = empty($item['installer']) ? '' : $sanitizer->entities($item['installer']);
@@ -281,13 +281,12 @@ class ProcessWireUpgrade extends Process {
281
281
if(!empty($item['pro'])) $title .= $proLabel;
282
282
283
283
} else if(!empty($item['pro'])) {
284
+ $title = $this->a($upgradeURL, $title) . $proLabel;
284
285
if($item['new'] > 0) {
285
286
if(!empty($urls['support'])) $upgradeURL = $urls['support'];
286
287
$protip = 'PRO module upgrade available in ProcessWire VIP support board (login required)';
287
288
$upgrade = $this->tooltip($protip, $this->aa($upgradeURL, $upgradeLabel));
288
- $title = $this->tooltip($protip, $this->aa($upgradeURL, $title) . $proLabel);
289
- } else {
290
- $title = $this->a($upgradeURL, $title) . $proLabel;
289
+ // $title = $this->tooltip($protip, $this->aa($upgradeURL, $title) . $proLabel);
291
290
}
292
291
$numPro++;
293
292
@@ -306,12 +305,10 @@ class ProcessWireUpgrade extends Process {
306
305
}
307
306
}
308
307
309
- $lastRefresh = $this->session->getFor($this, 'lastRefresh');
310
-
311
308
return
312
309
$table->render() .
313
- $this->p(sprintf( $this->_('Last refresh: %s'), wireRelativeTimeStr($lastRefresh)), 'description' ) .
314
- $this->refreshButton(true)->render ();
310
+ $this->p($this->refreshButton(true)->render() ) .
311
+ $this->lastRefreshInfo ();
315
312
}
316
313
317
314
/**
@@ -320,7 +317,7 @@ class ProcessWireUpgrade extends Process {
320
317
*/
321
318
public function executeRefresh() {
322
319
$this->session->setFor($this, 'lastRefresh', time());
323
- $this->modules->resetCache();
320
+ if(method_exists($this->modules, 'resetCache')) $this->modules->resetCache();
324
321
$this->checker->getVersions(true);
325
322
$this->message($this->_('Refreshed module versions data'));
326
323
$this->session->redirect('./');
@@ -884,6 +881,19 @@ class ProcessWireUpgrade extends Process {
884
881
return $btn;
885
882
}
886
883
884
+ /**
885
+ * @param bool $paragraph
886
+ * @return string
887
+ *
888
+ */
889
+ protected function lastRefreshInfo($paragraph = true) {
890
+ $lastRefresh = $this->session->getFor($this, 'lastRefresh');
891
+ $lastRefresh = $lastRefresh ? wireRelativeTimeStr($lastRefresh) : $this->_('N/A');
892
+ $out = sprintf($this->_('Last refresh: %s'), $lastRefresh);
893
+ if($paragraph) $out = $this->p($out, 'detail last-refresh-info');
894
+ return $out;
895
+ }
896
+
887
897
/**
888
898
* Process rename operations
889
899
*
0 commit comments