diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index 9c20ad8dfe..32f8c1f97d 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -4,6 +4,8 @@ HumHub Change Log 1.2.0-beta.3 under developement -------------------------------- +- Fix: Added unknown upload error if server cancels upload (e.g in case of a post_max_size violation issue) +- Enh: Added warning if php max upload/post is less than the humhub setting. - Enh: Added mp4/ogg blueimp support in post gallery - Enh: Added global (default) notification space settings - Enh: #2359 Use Jplayer playlist feature for post mp3 diff --git a/protected/humhub/modules/admin/controllers/SettingController.php b/protected/humhub/modules/admin/controllers/SettingController.php index 49663137da..9903d6cec5 100644 --- a/protected/humhub/modules/admin/controllers/SettingController.php +++ b/protected/humhub/modules/admin/controllers/SettingController.php @@ -192,17 +192,25 @@ class SettingController extends Controller // Determine PHP Upload Max FileSize $maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('upload_max_filesize')); + $fileSizeKey = 'upload_max_filesize'; if ($maxUploadSize > \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'))) { $maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size')); + $fileSizeKey = 'post_max_size'; } + $maxUploadSize = floor($maxUploadSize / 1024 / 1024); - + $maxUploadSizeText = "(".$fileSizeKey."): ".$maxUploadSize; + // Determine currently used ImageLibary $currentImageLibary = 'GD'; - if (Yii::$app->getModule('file')->settings->get('imageMagickPath')) + if (Yii::$app->getModule('file')->settings->get('imageMagickPath')) { $currentImageLibary = 'ImageMagick'; + } - return $this->render('file', array('model' => $form, 'maxUploadSize' => $maxUploadSize, 'currentImageLibary' => $currentImageLibary)); + return $this->render('file', ['model' => $form, + 'maxUploadSize' => $maxUploadSize, + 'maxUploadSizeText' => $maxUploadSizeText, + 'currentImageLibary' => $currentImageLibary]); } /** diff --git a/protected/humhub/modules/admin/views/setting/file.php b/protected/humhub/modules/admin/views/setting/file.php index 6b8dd3ec21..88c879c5f7 100644 --- a/protected/humhub/modules/admin/views/setting/file.php +++ b/protected/humhub/modules/admin/views/setting/file.php @@ -22,7 +22,9 @@ use humhub\models\Setting;
labelEx($model, 'maxFileSize'); ?> textField($model, 'maxFileSize', array('class' => 'form-control', 'readonly' => Setting::IsFixed('maxFileSize', 'file'))); ?> -

$maxUploadSize)); ?>

+

maxFileSize > $maxUploadSize) ? 'style="color:'.$this->theme->variable('danger').' !important"' : ''?>> + $maxUploadSizeText)); ?> +

diff --git a/protected/humhub/modules/file/resources/js/humhub.file.js b/protected/humhub/modules/file/resources/js/humhub.file.js index 25d81287be..07c7c27557 100644 --- a/protected/humhub/modules/file/resources/js/humhub.file.js +++ b/protected/humhub/modules/file/resources/js/humhub.file.js @@ -211,6 +211,11 @@ humhub.module('file', function (module, require, $) { Upload.prototype.done = function (e, response) { var that = this; + + if(!response.result.files || !response.result.files.length) { + module.log.error('error.unknown', true); + } + $.each(response.result.files, function (index, file) { that.handleFileResponse(file); }); diff --git a/protected/humhub/modules/file/widgets/views/showFiles.php b/protected/humhub/modules/file/widgets/views/showFiles.php index 20ccb4d753..60f55f825a 100644 --- a/protected/humhub/modules/file/widgets/views/showFiles.php +++ b/protected/humhub/modules/file/widgets/views/showFiles.php @@ -1,7 +1,7 @@ context->object; ?> @@ -13,15 +13,15 @@ $object = $this->context->object;
applyFile($file)): ?> - getUniqueId(); ?>" href="getUrl(); ?>#.jpeg" title="file_name ?>"> + getUniqueId(); ?>" href="getUrl(); ?>#.jpeg" title="file_name) ?>"> render(); ?> file_name) == 'mp4'): ?> - getUniqueId(); ?>" type="video/mp4" href="getUrl(); ?>#.mp4" title="file_name ?>"> + getUniqueId(); ?>" type="video/mp4" href="getUrl(); ?>#.mp4" title="file_name) ?>"> file_name) == 'ogv'): ?> - getUniqueId(); ?>" type="video/ogg" href="getUrl(); ?>#.ogv" title="file_name ?>"> + getUniqueId(); ?>" type="video/ogg" href="getUrl(); ?>#.ogv" title="file_name) ?>"> diff --git a/protected/humhub/widgets/CoreJsConfig.php b/protected/humhub/widgets/CoreJsConfig.php index 0643aef0ec..1be77625c8 100644 --- a/protected/humhub/widgets/CoreJsConfig.php +++ b/protected/humhub/widgets/CoreJsConfig.php @@ -56,6 +56,9 @@ class CoreJsConfig extends Widget ], 'text' => [ 'error.upload' => Yii::t('base', 'Some files could not be uploaded:'), + 'error.unknown' => Yii::$app->user->isAdmin() ? + Yii::t('base', 'An unknown error occured while uploading. Hint: check your upload_max_filesize and post_max_size php settings.') + : Yii::t('base', 'An unknown error occured while uploading.'), 'success.delete' => Yii::t('base', 'The file has been deleted.') ] ],