mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 06:08:21 +01:00
Merge branch 'develop' of github.com:humhub/humhub into develop
This commit is contained in:
commit
50d7dbb920
@ -7,6 +7,8 @@ HumHub Changelog
|
||||
- Enh #7070: Add GitHub action for PHP CS Fixer
|
||||
- Enh #7073: Add a link to notification settings on top dropdown list
|
||||
- Fix #7100: Enable all file handlers on RichText editor toolbar
|
||||
- Enh #7127: Prerequisites - Check that Web and Cli php version and user is the same
|
||||
- Enh #7128: Prerequisites - check for mixed table collations
|
||||
|
||||
1.16.2 (Unreleased)
|
||||
---------------------
|
||||
|
@ -9,6 +9,7 @@
|
||||
namespace humhub\commands;
|
||||
|
||||
use DateTime;
|
||||
use humhub\libs\SelfTest;
|
||||
use Yii;
|
||||
use yii\console\Controller;
|
||||
use yii\console\ExitCode;
|
||||
@ -37,6 +38,16 @@ class CronController extends Controller
|
||||
*/
|
||||
public const MUTEX_ID = 'cron-mutex';
|
||||
|
||||
public function beforeAction($action)
|
||||
{
|
||||
Yii::$app->cache->set(SelfTest::PHP_INFO_CACHE_KEY, [
|
||||
'version' => phpversion(),
|
||||
'user' => get_current_user(),
|
||||
]);
|
||||
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the cron jobs
|
||||
|
@ -24,6 +24,8 @@ use yii\helpers\UnsetArrayValue;
|
||||
*/
|
||||
class SelfTest
|
||||
{
|
||||
public const PHP_INFO_CACHE_KEY = 'cron_php_info';
|
||||
|
||||
/**
|
||||
* Get Results of the Application SelfTest.
|
||||
*
|
||||
@ -481,6 +483,45 @@ class SelfTest
|
||||
}
|
||||
}
|
||||
|
||||
// Checks that WebApp and ConsoleApp uses the same php version and same user
|
||||
if (Yii::$app->cache->exists(self::PHP_INFO_CACHE_KEY)) {
|
||||
$cronPhpInfo = Yii::$app->cache->get(self::PHP_INFO_CACHE_KEY);
|
||||
|
||||
if ($cronPhpVersion = ArrayHelper::getValue($cronPhpInfo, 'version')) {
|
||||
$title = Yii::t('AdminModule.information', 'Settings') . ' - ' . Yii::t('AdminModule.information', 'Web Application and Cron uses the same PHP version');
|
||||
|
||||
if ($cronPhpVersion == phpversion()) {
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'OK',
|
||||
];
|
||||
} else {
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'WARNING',
|
||||
'hint' => Yii::t('AdminModule.information', 'Web Application PHP version: `{webPhpVersion}`, Cron PHP Version: `{cronPhpVersion}`', ['webPhpVersion' => phpversion(), 'cronPhpVersion' => $cronPhpVersion]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($cronPhpUser = ArrayHelper::getValue($cronPhpInfo, 'user')) {
|
||||
$title = Yii::t('AdminModule.information', 'Settings') . ' - ' . Yii::t('AdminModule.information', 'Web Application and Cron uses the same user');
|
||||
|
||||
if ($cronPhpUser == get_current_user()) {
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'OK',
|
||||
];
|
||||
} else {
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'WARNING',
|
||||
'hint' => Yii::t('AdminModule.information', 'Web Application user: `{webUser}`, Cron user: `{cronUser}`', ['webUser' => get_current_user(), 'cronUser' => $cronPhpUser]),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check Runtime Directory
|
||||
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Runtime');
|
||||
$path = Yii::getAlias('@runtime');
|
||||
@ -670,7 +711,7 @@ class SelfTest
|
||||
$tablesWithNotRecommendedEngines = [];
|
||||
foreach ($dbTables as $dbTable) {
|
||||
if (!in_array($dbTable['Collation'], $tableCollations)) {
|
||||
$tableCollations[] = $dbTable['Collation'];
|
||||
$tableCollations[ArrayHelper::getValue($dbTable, 'Name')] = ArrayHelper::getValue($dbTable, 'Collation');
|
||||
}
|
||||
if (!is_string($dbTable['Collation']) || stripos($dbTable['Collation'], $recommendedCollation) !== 0) {
|
||||
$tablesWithNotRecommendedCollations[] = $dbTable['Name'];
|
||||
@ -686,19 +727,31 @@ class SelfTest
|
||||
// Checks Table Collations
|
||||
$title = $driver['title'] . ' - ' . Yii::t('AdminModule.information', 'Table collations') . ' - ' . implode(', ', $tableCollations);
|
||||
|
||||
if (empty($tablesWithNotRecommendedCollations)) {
|
||||
if (empty($tablesWithNotRecommendedCollations) && count($tableCollations) == 1) {
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'OK',
|
||||
];
|
||||
} else {
|
||||
$hint = [];
|
||||
|
||||
if (count($tableCollations) > 1) {
|
||||
$hint[] = Yii::t('AdminModule.information', 'Different table collations in the tables: {tables}', [
|
||||
'tables' => http_build_query($tableCollations, '', ', '),
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($tablesWithNotRecommendedCollations)) {
|
||||
$hint[] = Yii::t('AdminModule.information', 'Recommended collation is {collation} for the tables: {tables}', [
|
||||
'collation' => $recommendedCollation,
|
||||
'tables' => implode(', ', $tablesWithNotRecommendedCollations),
|
||||
]);
|
||||
}
|
||||
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'WARNING',
|
||||
'hint' => Yii::t('AdminModule.information', 'Recommended collation is {collation} for the tables: {tables}', [
|
||||
'collation' => $recommendedCollation,
|
||||
'tables' => implode(', ', $tablesWithNotRecommendedCollations),
|
||||
]),
|
||||
'hint' => implode('. ', $hint),
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user