Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show current update channel with link to module configuration #25

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>