Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit cf7a114

Browse files
author
Jamie Snape
committed
Fix upgrade tab
1 parent b9c981c commit cf7a114

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

core/controllers/AdminController.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,20 +326,15 @@ public function upgradeAction()
326326

327327
$modules = array();
328328
foreach ($modulesConfig as $key => $module) {
329-
$this->Component->Upgrade->initUpgrade($key, $db, $dbtype);
330-
$modules[$key]['target'] = $this->Component->Upgrade->getNewestVersion();
331-
$modules[$key]['targetText'] = $this->Component->Upgrade->getNewestVersion(true);
332-
$modules[$key]['currentText'] = $module->version;
333-
$modules[$key]['current'] = $this->Component->Upgrade->transformVersionToNumeric($module->version);
329+
$modules[$key]['target'] = UtilityComponent::getLatestModuleVersion($key);
330+
$modules[$key]['current'] = UtilityComponent::getCurrentModuleVersion($key);
334331
}
335332

336333
$this->view->modules = $modules;
337334

338335
$this->Component->Upgrade->initUpgrade('core', $db, $dbtype);
339-
$core['target'] = $this->Component->Upgrade->getNewestVersion();
340-
$core['targetText'] = $this->Component->Upgrade->getNewestVersion(true);
341-
$core['currentText'] = $version;
342-
$core['current'] = $this->Component->Upgrade->transformVersionToNumeric($version);
336+
$core['target'] = UtilityComponent::getLatestModuleVersion('core');
337+
$core['current'] = UtilityComponent::getCurrentModuleVersion('core');
343338
$this->view->core = $core;
344339
}
345340

core/views/admin/upgrade.phtml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,31 @@
2222
<script type="text/javascript" src="<?php echo $this->coreWebroot ?>/public/js/admin/admin.upgrade.js"></script>
2323

2424
<h3>Core:</h3>
25-
Current version: <?php echo $this->escape($this->core['currentText']); ?><br/>
25+
Current version: <?php echo $this->escape($this->core['current']); ?><br/>
2626
<?php
27-
if ($this->core['current'] < $this->core['target']) {
28-
echo "Need to upgrade to version: ".$this->escape($this->core['targetText']);
27+
if (version_compare($this->core['current'], $this->core['target']) === -1) {
28+
echo 'Need to upgrade to version: '.$this->escape($this->core['target']);
2929
} else {
30-
echo "Midas Server is up to date.";
30+
echo 'Midas Server is up to date.';
3131
}
3232
?>
3333
<h3>Modules:</h3>
3434
<?php
3535
foreach ($this->modules as $name => $module) {
36-
echo "<b>{$this->escape($name)}</b><br/>";
37-
echo "Current version: {$this->escape($module['currentText'])} <br/>";
38-
if ($module['current'] < $module['target']) {
39-
echo "Need to upgrade to version: ".$this->escape($module['targetText']).'<br/>';
36+
echo '<b>'.$this->escape($name).'</b><br/>';
37+
echo 'Current version: '.$this->escape($module['current']).'<br/>';
38+
if (version_compare($module['current'], $module['target']) === -1) {
39+
echo 'Need to upgrade to version: '.$this->escape($module['target']).'<br/>';
4040
}
4141
}
4242

43-
if (count($this->modules) == 0) {
44-
echo "No module enabled.";
43+
if (count($this->modules) === 0) {
44+
echo 'No modules enabled.';
4545
}
4646
?>
4747
<br/>
4848
<br/>
49-
<form id='upgradeMIDAS' action="<?php echo $this->webroot ?>/admin/upgrade" method="post">
50-
<input type='submit' class="globalButton" value="Upgrade"/>
49+
<form id="upgradeMIDAS" action="<?php echo $this->webroot; ?>/admin/upgrade" method="post">
50+
<input type="submit" class="globalButton" value="Upgrade"/>
5151
</form>
52-
<br/><br/>
53-
<a href="<?php echo $this->webroot ?>/admin/migratemidas2">Upgrade from MIDAS2</a>
52+
<a href="<?php echo $this->webroot; ?>/admin/migratemidas2">Upgrade from Midas Server 2.x</a>

0 commit comments

Comments
 (0)