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

Commit

Permalink
Fix upgrade tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Oct 1, 2015
1 parent b9c981c commit cf7a114
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
13 changes: 4 additions & 9 deletions core/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,20 +326,15 @@ public function upgradeAction()

$modules = array();
foreach ($modulesConfig as $key => $module) {
$this->Component->Upgrade->initUpgrade($key, $db, $dbtype);
$modules[$key]['target'] = $this->Component->Upgrade->getNewestVersion();
$modules[$key]['targetText'] = $this->Component->Upgrade->getNewestVersion(true);
$modules[$key]['currentText'] = $module->version;
$modules[$key]['current'] = $this->Component->Upgrade->transformVersionToNumeric($module->version);
$modules[$key]['target'] = UtilityComponent::getLatestModuleVersion($key);
$modules[$key]['current'] = UtilityComponent::getCurrentModuleVersion($key);
}

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

$this->Component->Upgrade->initUpgrade('core', $db, $dbtype);
$core['target'] = $this->Component->Upgrade->getNewestVersion();
$core['targetText'] = $this->Component->Upgrade->getNewestVersion(true);
$core['currentText'] = $version;
$core['current'] = $this->Component->Upgrade->transformVersionToNumeric($version);
$core['target'] = UtilityComponent::getLatestModuleVersion('core');
$core['current'] = UtilityComponent::getCurrentModuleVersion('core');
$this->view->core = $core;
}

Expand Down
27 changes: 13 additions & 14 deletions core/views/admin/upgrade.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,31 @@
<script type="text/javascript" src="<?php echo $this->coreWebroot ?>/public/js/admin/admin.upgrade.js"></script>

<h3>Core:</h3>
Current version: <?php echo $this->escape($this->core['currentText']); ?><br/>
Current version: <?php echo $this->escape($this->core['current']); ?><br/>
<?php
if ($this->core['current'] < $this->core['target']) {
echo "Need to upgrade to version: ".$this->escape($this->core['targetText']);
if (version_compare($this->core['current'], $this->core['target']) === -1) {
echo 'Need to upgrade to version: '.$this->escape($this->core['target']);
} else {
echo "Midas Server is up to date.";
echo 'Midas Server is up to date.';
}
?>
<h3>Modules:</h3>
<?php
foreach ($this->modules as $name => $module) {
echo "<b>{$this->escape($name)}</b><br/>";
echo "Current version: {$this->escape($module['currentText'])} <br/>";
if ($module['current'] < $module['target']) {
echo "Need to upgrade to version: ".$this->escape($module['targetText']).'<br/>';
echo '<b>'.$this->escape($name).'</b><br/>';
echo 'Current version: '.$this->escape($module['current']).'<br/>';
if (version_compare($module['current'], $module['target']) === -1) {
echo 'Need to upgrade to version: '.$this->escape($module['target']).'<br/>';
}
}

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

0 comments on commit cf7a114

Please sign in to comment.