Skip to content

Commit

Permalink
Dev: Add new global setting to enable unstable extension updates (onl…
Browse files Browse the repository at this point in the history
…y for superadmin)
  • Loading branch information
olleharstedt committed Oct 2, 2018
1 parent b5f64a8 commit b545ece
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions application/controllers/admin/globalsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ private function _saveSettings()
SettingGlobal::setSetting('javascriptdebugbcknd', sanitize_paranoid_string(Yii::app()->getRequest()->getPost('javascriptdebugbcknd', false)));
SettingGlobal::setSetting('javascriptdebugfrntnd', sanitize_paranoid_string(Yii::app()->getRequest()->getPost('javascriptdebugfrntnd', false)));

// Unstable extensions can only be changed by super admin.
if (Permission::model()->hasGlobalPermission('superadmin', 'delete')) {
SettingGlobal::setSetting('allow_unstable_extension_update', sanitize_paranoid_string(Yii::app()->getRequest()->getPost('allow_unstable_extension_update', false)));
}

if (!Yii::app()->getConfig('demoMode')) {
$sTemplate = Yii::app()->getRequest()->getPost("defaulttheme");
if (array_key_exists($sTemplate, Template::getTemplateList())) {
Expand Down
26 changes: 26 additions & 0 deletions application/views/admin/global_settings/_general.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,32 @@
</div>
</div>
</div>

<!-- Allow unstable extension updates (only visible for super admin)-->
<?php if(Permission::model()->hasGlobalPermission('superadmin','read')):?>
<div class="row ls-space margin top-10">
<div class="form-group col-xs-12">
<label class="col-sm-12 text-left control-label" for='allow_unstable_extension_update'>
<?php eT('Allow unstable extension updates:'); ?>
</label>
<div class="col-sm-12">
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'allow_unstable_extension_update',
'id'=>'allow_unstable_extension_update',
'value' => getGlobalSetting('allow_unstable_extension_update'),
'onLabel'=>gT('On'),
'offLabel' => gT('Off')
));
?>
</div>
<div class="col-sm-12 control-label ">
<p class="text-info text-left">
<?php eT("Enabling unstable updates will allow you to try alpha and beta versions of extensions. Talk to the extension author for more information.");?>
</p>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>

Expand Down

0 comments on commit b545ece

Please sign in to comment.