mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Enh #2238: Added APCu Support
This commit is contained in:
parent
44886ec209
commit
3f135214a6
@ -81,6 +81,7 @@ HumHub Change Log
|
||||
- Enh: Made admin base controller method "getAccessRules()" non static
|
||||
- Enh: Created new ImageController for user image and banner handling
|
||||
- Enh: Decreased OEmbed url max length 180chars (acs-ferreira)
|
||||
- Enh: Added APCu Support
|
||||
|
||||
1.2.0-beta.2 (February 24, 2017)
|
||||
--------------------------------
|
||||
|
@ -11,7 +11,6 @@ namespace humhub\libs;
|
||||
use Yii;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
|
||||
/**
|
||||
* DynamicConfig provides access to the dynamic configuration file.
|
||||
*
|
||||
@ -109,12 +108,19 @@ class DynamicConfig extends \yii\base\Object
|
||||
|
||||
// Add Caching
|
||||
$cacheClass = Yii::$app->settings->get('cache.class');
|
||||
if (in_array($cacheClass, ['yii\caching\DummyCache', 'yii\caching\ApcCache', 'yii\caching\FileCache'])) {
|
||||
if (in_array($cacheClass, ['yii\caching\DummyCache', 'yii\caching\FileCache'])) {
|
||||
$config['components']['cache'] = [
|
||||
'class' => $cacheClass,
|
||||
'keyPrefix' => Yii::$app->id
|
||||
];
|
||||
} elseif ($cacheClass == 'yii\caching\ApcCache' && (function_exists('apcu_add') || function_exists('apc_add'))) {
|
||||
$config['components']['cache'] = [
|
||||
'class' => $cacheClass,
|
||||
'keyPrefix' => Yii::$app->id,
|
||||
'useApcu' => (function_exists('apcu_add'))
|
||||
];
|
||||
}
|
||||
|
||||
// Add User settings
|
||||
$config['components']['user'] = array();
|
||||
if (Yii::$app->getModule('user')->settings->get('auth.defaultUserIdleTimeoutSec')) {
|
||||
@ -133,7 +139,7 @@ class DynamicConfig extends \yii\base\Object
|
||||
|
||||
if (Yii::$app->settings->get('mailer.username')) {
|
||||
$mail['transport']['username'] = Yii::$app->settings->get('mailer.username');
|
||||
} else if(!Yii::$app->settings->get('mailer.password')) {
|
||||
} else if (!Yii::$app->settings->get('mailer.password')) {
|
||||
$mail['transport']['authMode'] = 'null';
|
||||
}
|
||||
|
||||
@ -163,7 +169,7 @@ class DynamicConfig extends \yii\base\Object
|
||||
$config['components']['mailer'] = $mail;
|
||||
$config = ArrayHelper::merge($config, ThemeHelper::getThemeConfig(Yii::$app->settings->get('theme')));
|
||||
$config['params']['config_created_at'] = time();
|
||||
|
||||
|
||||
$config['params']['horImageScrollOnMobile'] = Yii::$app->settings->get('horImageScrollOnMobile');
|
||||
|
||||
self::save($config);
|
||||
|
@ -204,7 +204,7 @@ class SelfTest
|
||||
}
|
||||
|
||||
// Checks APC Extension
|
||||
$title = 'PHP - APC Support';
|
||||
$title = 'PHP - APC(u) Support';
|
||||
if (function_exists('apc_add') || function_exists('apcu_add')) {
|
||||
$checks[] = array(
|
||||
'title' => Yii::t('base', $title),
|
||||
@ -214,7 +214,7 @@ class SelfTest
|
||||
$checks[] = array(
|
||||
'title' => Yii::t('base', $title),
|
||||
'state' => 'WARNING',
|
||||
'hint' => 'Optional - Install APC Extension for APC Caching'
|
||||
'hint' => 'Optional - Install APCu Extension for APC Caching'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -110,13 +110,7 @@ class SettingController extends Controller
|
||||
return $this->redirect(['/admin/setting/caching']);
|
||||
}
|
||||
|
||||
$cacheTypes = array(
|
||||
'yii\caching\DummyCache' => Yii::t('AdminModule.controllers_SettingController', 'No caching (Testing only!)'),
|
||||
'yii\caching\FileCache' => Yii::t('AdminModule.controllers_SettingController', 'File'),
|
||||
'yii\caching\ApcCache' => Yii::t('AdminModule.controllers_SettingController', 'APC'),
|
||||
);
|
||||
|
||||
return $this->render('caching', array('model' => $form, 'cacheTypes' => $cacheTypes));
|
||||
return $this->render('caching', array('model' => $form, 'cacheTypes' => $form->getTypes()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,20 +191,20 @@ class SettingController extends Controller
|
||||
$maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'));
|
||||
$fileSizeKey = 'post_max_size';
|
||||
}
|
||||
|
||||
|
||||
$maxUploadSize = floor($maxUploadSize / 1024 / 1024);
|
||||
$maxUploadSizeText = "(".$fileSizeKey."): ".$maxUploadSize;
|
||||
|
||||
$maxUploadSizeText = "(" . $fileSizeKey . "): " . $maxUploadSize;
|
||||
|
||||
// Determine currently used ImageLibary
|
||||
$currentImageLibary = 'GD';
|
||||
if (Yii::$app->getModule('file')->settings->get('imageMagickPath')) {
|
||||
$currentImageLibary = 'ImageMagick';
|
||||
}
|
||||
|
||||
return $this->render('file', ['model' => $form,
|
||||
'maxUploadSize' => $maxUploadSize,
|
||||
'maxUploadSizeText' => $maxUploadSizeText,
|
||||
'currentImageLibary' => $currentImageLibary]);
|
||||
return $this->render('file', ['model' => $form,
|
||||
'maxUploadSize' => $maxUploadSize,
|
||||
'maxUploadSizeText' => $maxUploadSizeText,
|
||||
'currentImageLibary' => $currentImageLibary]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -242,9 +236,9 @@ class SettingController extends Controller
|
||||
{
|
||||
$logsCount = Log::find()->count();
|
||||
$dating = Log::find()
|
||||
->orderBy('log_time', 'asc')
|
||||
->limit(1)
|
||||
->one();
|
||||
->orderBy('log_time', 'asc')
|
||||
->limit(1)
|
||||
->one();
|
||||
|
||||
// I wish..
|
||||
if ($dating) {
|
||||
@ -264,10 +258,10 @@ class SettingController extends Controller
|
||||
}
|
||||
|
||||
return $this->render('logs', array(
|
||||
'logsCount' => $logsCount,
|
||||
'model' => $form,
|
||||
'limitAgeOptions' => $limitAgeOptions,
|
||||
'dating' => $dating
|
||||
'logsCount' => $logsCount,
|
||||
'model' => $form,
|
||||
'limitAgeOptions' => $limitAgeOptions,
|
||||
'dating' => $dating
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,9 @@ class CacheSettingsForm extends Model
|
||||
public function getTypes()
|
||||
{
|
||||
return array(
|
||||
'yii\caching\DummyCache' => \Yii::t('AdminModule.forms_CacheSettingsForm', 'No caching (Testing only!)'),
|
||||
'yii\caching\DummyCache' => \Yii::t('AdminModule.forms_CacheSettingsForm', 'No caching'),
|
||||
'yii\caching\FileCache' => \Yii::t('AdminModule.forms_CacheSettingsForm', 'File'),
|
||||
'yii\caching\ApcCache' => \Yii::t('AdminModule.forms_CacheSettingsForm', 'APC'),
|
||||
'yii\caching\ApcCache' => \Yii::t('AdminModule.forms_CacheSettingsForm', 'APC(u)'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -69,8 +69,8 @@ class CacheSettingsForm extends Model
|
||||
*/
|
||||
public function checkCacheType($attribute, $params)
|
||||
{
|
||||
if ($this->type == 'yii\caching\ApcCache' && !function_exists('apc_add')) {
|
||||
$this->addError($attribute, \Yii::t('AdminModule.forms_CacheSettingsForm', "PHP APC Extension missing - Type not available!"));
|
||||
if ($this->type == 'yii\caching\ApcCache' && !function_exists('apc_add') && !function_exists('apc_addu')) {
|
||||
$this->addError($attribute, \Yii::t('AdminModule.forms_CacheSettingsForm', "PHP APC(u) Extension missing - Type not available!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user