Skip to content

Commit

Permalink
Merge pull request #25 from humhub/enh/24-show-current-update-channel
Browse files Browse the repository at this point in the history
Show current update channel with link to module configuration
  • Loading branch information
luke- authored Feb 5, 2021
2 parents f83d275 + d2ce4af commit 469e0d6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
19 changes: 18 additions & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace humhub\modules\updater;

use humhub\models\Setting;
use humhub\modules\updater\models\ConfigureForm;
use Yii;
use yii\base\Exception;
use yii\helpers\Url;
Expand Down Expand Up @@ -73,9 +74,25 @@ public function getCurlOptions()
return \humhub\libs\CURLHelper::getOptions();
}


/**
* Get current update channel value
*
* @return string
*/
public function getUpdateChannel()
{
return $this->settings->get('channel', 'stable');
}

/**
* Get current update channel title
*
* @return string
*/
public function getUpdateChannelTitle()
{
$updateChannel = $this->getUpdateChannel();
$updateChannelTitles = ConfigureForm::getChannels();
return isset($updateChannelTitles[$updateChannel]) ? $updateChannelTitles[$updateChannel] : $updateChannel;
}
}
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

2.1.10 (Unreleased)
--------------------------
- Enh #24: Show current update channel with link to module configuration

2.1.9 (February 5, 2021)
--------------------------
- Fix: Better handle errors when assets directory cannot be cleared (+ retry)
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"humhub": {
"minVersion": "1.0"
},
"version": "2.1.9"
"version": "2.1.10"
}
2 changes: 1 addition & 1 deletion views/update/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<?php if ($newUpdaterAvailable): ?>
<br />
<div class="alert alert-danger">
<?= Html::a('Update', ['/admin/module/list-updates'], ['class' => 'btn btn-danger pull-right']); ?>
<?= Html::a('Update', ['/marketplace/update'], ['class' => 'btn btn-danger pull-right']); ?>
<strong><?php echo Yii::t('UpdaterModule.base', 'New updater version available!'); ?></strong><br />
<?php echo Yii::t('UpdaterModule.base', 'There is a new version of the updater module available. Please update before proceed.'); ?>
</div>
Expand Down
8 changes: 6 additions & 2 deletions views/update/index_noupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
<div class="panel-body">

<?php echo Yii::t('UpdaterModule.base', 'There is no new HumHub update available!'); ?>
<br />

<br /><br />

<?= Yii::t('UpdaterModule.base', 'Current update channel: {updateChannel}', [
'updateChannel' => '<strong>' . Yii::$app->getModule('updater')->getUpdateChannelTitle() . '</strong>'
]); ?>
<?= \humhub\libs\Html::a(Yii::t('UpdaterModule.base', 'Change'), \yii\helpers\Url::to(['/updater/admin']), ['class' => 'btn btn-primary btn-sm'] ); ?>
</div>

</div>

0 comments on commit 469e0d6

Please sign in to comment.