mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Rename cahce config keys (#7346)
* Change cache settings key to meet dot env naming * Change cache settings keys to meet dot env naming * Change cache settings keys to meet dot env naming * Change cache settings keys to meet dot env naming
This commit is contained in:
parent
c231e5c309
commit
0f28b87266
@ -35,6 +35,7 @@ HumHub Changelog
|
||||
- Fix #7301: Profile header: on small screens, the space at the left and the right of the image must be equal
|
||||
- Fix #7298: Don't check email for existing on password recovery (CVE-2024-52043)
|
||||
- Enh #7038: Optimize notification overview
|
||||
- Enh #7346: Change cache settings keys to meet dot env naming
|
||||
|
||||
1.17.0-beta.1 (October 28, 2024)
|
||||
--------------------------------
|
||||
|
@ -91,7 +91,7 @@ class DynamicConfig extends BaseObject
|
||||
$config['name'] = Yii::$app->settings->get('name');
|
||||
|
||||
// Add Caching
|
||||
$cacheClass = Yii::$app->settings->get('cache.class');
|
||||
$cacheClass = Yii::$app->settings->get('cacheClass');
|
||||
if (in_array($cacheClass, ['yii\caching\DummyCache', 'yii\caching\FileCache'])) {
|
||||
$config['components']['cache'] = [
|
||||
'class' => $cacheClass,
|
||||
@ -189,7 +189,7 @@ class DynamicConfig extends BaseObject
|
||||
public static function needRewrite($moduleId, $name)
|
||||
{
|
||||
return (in_array($name, [
|
||||
'name', 'defaultLanguage', 'timeZone', 'cache.class', 'mailer.transportType',
|
||||
'name', 'defaultLanguage', 'timeZone', 'cacheClass', 'mailer.transportType',
|
||||
'mailer.hostname', 'mailer.username', 'mailer.password', 'mailer.encryption',
|
||||
'mailer.port', 'horImageScrollOnMobile']));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
use yii\db\Expression;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160508_005740_settings_cleanup extends Migration
|
||||
{
|
||||
|
@ -29,9 +29,9 @@ class CacheSettingsForm extends Model
|
||||
parent::init();
|
||||
|
||||
$settingsManager = Yii::$app->settings;
|
||||
$this->type = $settingsManager->get('cache.class');
|
||||
$this->expireTime = $settingsManager->get('cache.expireTime');
|
||||
$this->reloadableScripts = $settingsManager->get('cache.reloadableScripts');
|
||||
$this->type = $settingsManager->get('cacheClass');
|
||||
$this->expireTime = $settingsManager->get('cacheExpireTime');
|
||||
$this->reloadableScripts = $settingsManager->get('cacheReloadableScript');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,10 +45,10 @@ class CacheSettingsForm extends Model
|
||||
['type', 'checkCacheType'],
|
||||
['expireTime', 'integer'],
|
||||
['type', 'required', 'when' => function () {
|
||||
return !Yii::$app->settings->isFixed('cache.class');
|
||||
return !Yii::$app->settings->isFixed('cacheClass');
|
||||
}],
|
||||
['type', 'in', 'range' => array_keys($this->getTypes()), 'when' => function () {
|
||||
return !Yii::$app->settings->isFixed('cache.class');
|
||||
return !Yii::$app->settings->isFixed('cacheClass');
|
||||
}],
|
||||
];
|
||||
}
|
||||
@ -102,9 +102,9 @@ class CacheSettingsForm extends Model
|
||||
{
|
||||
$settingsManager = Yii::$app->settings;
|
||||
|
||||
$settingsManager->set('cache.class', $this->type);
|
||||
$settingsManager->set('cache.expireTime', $this->expireTime);
|
||||
$settingsManager->set('cache.reloadableScripts', $this->reloadableScripts);
|
||||
$settingsManager->set('cacheClass', $this->type);
|
||||
$settingsManager->set('cacheExpireTime', $this->expireTime);
|
||||
$settingsManager->set('cacheReloadableScript', $this->reloadableScripts);
|
||||
|
||||
DynamicConfig::rewrite();
|
||||
self::flushCache();
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\admin\models\forms\CacheSettingsForm;
|
||||
use humhub\widgets\Button;
|
||||
use humhub\modules\ui\form\widgets\ActiveForm;
|
||||
use humhub\widgets\Button;
|
||||
|
||||
/* @var $cacheTypes [] */
|
||||
/* @var $model CacheSettingsForm */
|
||||
@ -13,11 +13,11 @@ use humhub\modules\ui\form\widgets\ActiveForm;
|
||||
|
||||
<?php $form = ActiveForm::begin(['acknowledge' => true]); ?>
|
||||
|
||||
<?php if (!Yii::$app->settings->isFixed('cache.class')): ?>
|
||||
<?= $form->field($model, 'type')->dropDownList($cacheTypes, ['readonly' => Yii::$app->settings->isFixed('cache.class')]) ?>
|
||||
<?php if (!Yii::$app->settings->isFixed('cacheClass')): ?>
|
||||
<?= $form->field($model, 'type')->dropDownList($cacheTypes, ['readonly' => Yii::$app->settings->isFixed('cacheClass')]) ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $form->field($model, 'expireTime')->textInput(['readonly' => Yii::$app->settings->isFixed('cache.expireTime')]) ?>
|
||||
<?= $form->field($model, 'expireTime')->textInput(['readonly' => Yii::$app->settings->isFixed('cacheExpireTime')]) ?>
|
||||
|
||||
<hr>
|
||||
<?= Button::primary(Yii::t('AdminModule.settings', 'Save & Flush Caches'))->submit() ?>
|
||||
|
@ -252,7 +252,7 @@ class Comment extends ContentAddonActiveRecord
|
||||
$comments[$limit] = array_reverse($query->all());
|
||||
|
||||
if ($useCaching) {
|
||||
Yii::$app->cache->set($cacheID, $comments, Yii::$app->settings->get('cache.expireTime'));
|
||||
Yii::$app->cache->set($cacheID, $comments, Yii::$app->settings->get('cacheExpireTime'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ class Comment extends ContentAddonActiveRecord
|
||||
|
||||
if ($commentCount === false) {
|
||||
$commentCount = Comment::find()->where(['object_model' => $model, 'object_id' => $id])->count();
|
||||
Yii::$app->cache->set($cacheID, $commentCount, Yii::$app->settings->get('cache.expireTime'));
|
||||
Yii::$app->cache->set($cacheID, $commentCount, Yii::$app->settings->get('cacheExpireTime'));
|
||||
}
|
||||
|
||||
return $commentCount;
|
||||
|
@ -63,8 +63,8 @@ class InitialData
|
||||
Yii::$app->getModule('file')->settings->set('excludeMediaFilesPreview', '1');
|
||||
|
||||
// Caching
|
||||
Yii::$app->settings->set('cache.class', 'yii\caching\FileCache');
|
||||
Yii::$app->settings->set('cache.expireTime', '3600');
|
||||
Yii::$app->settings->set('cacheClass', 'yii\caching\FileCache');
|
||||
Yii::$app->settings->set('cacheExpireTime', '3600');
|
||||
Yii::$app->getModule('admin')->settings->set('installationId', md5(uniqid("", true)));
|
||||
|
||||
// Design
|
||||
|
@ -9,11 +9,11 @@
|
||||
namespace humhub\modules\like\models;
|
||||
|
||||
use humhub\components\behaviors\PolymorphicRelation;
|
||||
use humhub\modules\like\activities\Liked;
|
||||
use Yii;
|
||||
use humhub\modules\content\components\ContentAddonActiveRecord;
|
||||
use humhub\modules\content\interfaces\ContentOwner;
|
||||
use humhub\modules\like\activities\Liked;
|
||||
use humhub\modules\like\notifications\NewLike;
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
/**
|
||||
@ -88,7 +88,7 @@ class Like extends ContentAddonActiveRecord
|
||||
->with('user')
|
||||
->all();
|
||||
},
|
||||
Yii::$app->settings->get('cache.expireTime'),
|
||||
Yii::$app->settings->get('cacheExpireTime'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,10 @@ use RecursiveIteratorIterator;
|
||||
use Yii;
|
||||
use yii\base\Component;
|
||||
use yii\base\ErrorException;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\web\HttpException;
|
||||
use yii\base\Exception;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\helpers\FileHelper;
|
||||
use yii\web\HttpException;
|
||||
use yii\web\ServerErrorHttpException;
|
||||
use ZipArchive;
|
||||
|
||||
@ -259,7 +259,7 @@ class OnlineModuleManager extends Component
|
||||
unset($this->_modules[$blacklistedModuleId]);
|
||||
}
|
||||
|
||||
Yii::$app->cache->set('onlineModuleManager_modules', $this->_modules, Yii::$app->settings->get('cache.expireTime'));
|
||||
Yii::$app->cache->set('onlineModuleManager_modules', $this->_modules, Yii::$app->settings->get('cacheExpireTime'));
|
||||
}
|
||||
|
||||
return $this->_modules;
|
||||
|
@ -23,8 +23,8 @@ return [
|
||||
['name' => 'receive_email_notifications', 'value' => '2', 'module_id' => 'notification'],
|
||||
['name' => 'maxFileSize', 'value' => '1048576', 'module_id' => 'file'],
|
||||
['name' => 'forbiddenExtensions', 'value' => 'exe', 'module_id' => 'file'],
|
||||
['name' => 'cache.class', 'value' => 'CFileCache', 'module_id' => 'base'],
|
||||
['name' => 'cache.expireTime', 'value' => '3600', 'module_id' => 'base'],
|
||||
['name' => 'cacheClass', 'value' => 'CFileCache', 'module_id' => 'base'],
|
||||
['name' => 'cacheExpireTime', 'value' => '3600', 'module_id' => 'base'],
|
||||
['name' => 'installationId', 'value' => '99846c45e9b9b0962238986a6fed519a', 'module_id' => 'admin'],
|
||||
['name' => 'theme', 'value' => 'HumHub', 'module_id' => 'base'],
|
||||
['name' => 'tour', 'value' => '1', 'module_id' => 'base'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user