Commit 28080e80 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen

Merge branch 'bugfix/throw-exception-for-empty-upload-comment' into 'develop'

Throw an extension when upload with empty upload comment

See merge request !363
parents b4158404 3fb36691
Pipeline #4993 passed with stages
in 6 minutes and 22 seconds
<?php
namespace T3o\Ter\Exception;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
class NoUploadCommentException extends Exception
{
}
......@@ -169,6 +169,13 @@ class tx_ter_api
);
}
if (trim((string)$extensionInfoData->infoData->uploadComment) === '') {
throw new \T3o\Ter\Exception\NoUploadCommentException(
'You need to set an upload comment!',
TX_TER_ERROR_UPLOADEXTENSION_NOUPLOADCOMMENT
);
}
if (($typo3DependencyCheck = static::checkExtensionDependencyOnSupportedTypo3Version($extensionInfoData)) !== true && $uploadUserRecordArr['admin'] !== true) {
switch ($typo3DependencyCheck) {
case TX_TER_ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYINCORRECT:
......@@ -982,7 +989,7 @@ class tx_ter_api
$extensionDetailsRow = [
'pid' => (int)$this->parentObj->extensionsPID,
'extensionuid' => (int)$extensionUid,
'uploadcomment' => $extensionInfoData->infoData->uploadComment,
'uploadcomment' => (string)$extensionInfoData->infoData->uploadComment,
'lastuploadbyusername' => $accountData->username,
'lastuploaddate' => $GLOBALS['SIM_EXEC_TIME'],
'datasize' => $extensionInfoData->infoData->dataSize,
......
......@@ -62,6 +62,7 @@ define('TX_TER_ERROR_UPLOADEXTENSION_ACCESSDENIED', '208');
define('TX_TER_ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYINCORRECT', '209');
define('TX_TER_ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYCHECKFAILED', '210');
define('TX_TER_ERROR_UPLOADEXTENSION_EXTENSIONVERSIONEXISTS', '211');
define('TX_TER_ERROR_UPLOADEXTENSION_NOUPLOADCOMMENT', '212');
define('TX_TER_ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY', '300');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment