Commit d7516259 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Merge branch 'develop' into feature/encapsulate-core-versions-fetching

parents b1e3460f 00ef09c5
Pipeline #9564 failed with stages
in 1 minute and 9 seconds
......@@ -35,20 +35,6 @@ test:unit:
script:
- composer install --ignore-platform-reqs
- composer test:unit
layout:
stage: layout
image: node:8
before_script:
- cd private/typo3conf/ext/t3olayout/Build
script:
- npm install
- npm run build
after_script:
- rm -Rf private/typo3conf/ext/t3olayout/Build/node_modules
artifacts:
paths:
- ./
expire_in: '4h'
dependencies:
- build
reports:
junit: build/*-report.xml
......@@ -18,4 +18,9 @@
<directory>../../extensions/ter_fe2/Tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../../extensions/ter_fe2/Classes/</directory>
</whitelist>
</filter>
</phpunit>
......@@ -58,6 +58,8 @@ set('bin_folder', 'vendor/bin/');
task('typo3', function() {
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:generatepackagestates');
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:extensionsetupifpossible');
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms upgrade:prepare -q');
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms upgrade:run databaseRowsUpdateWizard pagesLanguageOverlayBeGroupsAccessRights');
});
task('solr:host', function() {
......
......@@ -31,19 +31,17 @@
"ext-json": "*",
"ext-pdo": "*",
"ext-zlib": "*",
"apache-solr-for-typo3/solr": "^11.0",
"gordalina/cachetool": "^4.0",
"helhum/typo3-console": "^5.7",
"helhum/typo3-secure-web": "^0.2.9",
"nikic/php-parser": "^4.0",
"t3o/t3olayout": "^4.0",
"t3o/ter-frontend": "^0.4",
"t3o/ter-layout": "^0.1",
"t3o/ter-soap": "^2.0",
"typo3/cms-adminpanel": "^9.5",
"typo3/cms-seo": "^9.5"
"nimut/testing-framework": "^5.0",
"t3o/t3olayout": "^5.0",
"t3o/ter-frontend": "^0.5.0",
"t3o/ter-layout": "^0.2.0",
"t3o/ter-soap": "^2.1",
"typo3/cms-adminpanel": "^10.4",
"typo3/cms-seo": "^10.4"
},
"require-dev": {
"nimut/testing-framework": "^4.0",
"codeception/codeception": "^4.1",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-asserts": "^1.2"
......@@ -63,7 +61,7 @@
},
"scripts": {
"test:unit": [
"./vendor/bin/phpunit -c .gitlab-ci/Tests/UnitTests.xml"
"./vendor/bin/phpunit -c .gitlab-ci/Tests/UnitTests.xml --log-junit build/junit-report.xml --coverage-text --colors=never"
],
"test:api": [
"./vendor/bin/codecept run api --steps"
......
This diff is collapsed.
......@@ -11,6 +11,7 @@ namespace T3o\Ter\Api;
* of the License, or any later version.
*/
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use T3o\Ter\Exception\ExtensionKeyAlreadyInUseException;
use T3o\Ter\Exception\ExtensionKeyNotFoundException;
use T3o\Ter\Exception\InternalServerErrorException;
......@@ -20,6 +21,7 @@ use T3o\Ter\Exception\UserNotFoundException;
use T3o\Ter\Exception\VersionExistsException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -232,8 +234,15 @@ class ExtensionKey
if ($this->hasUploadedVersions()) {
throw new VersionExistsException('Cannot delete an extension, versions still exist', ResultCodes::ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST);
}
$uid = $this->getUid();
$conn = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_terfe2_domain_model_extension');
$conn->delete('tx_terfe2_domain_model_extension', ['ext_key' => $this->extensionKey]);
// remove from index queue
if (ExtensionManagementUtility::isLoaded('solr')) {
$indexQueue = GeneralUtility::makeInstance(Queue::class);
$indexQueue->deleteItem('tx_terfe2_domain_model_extension', $uid);
}
}
public function hasUploadedVersions(): bool
......@@ -338,6 +347,67 @@ class ExtensionKey
return true;
}
/**
* Updates some integrity information of the extension. Used when a version is uploaded or removed.
*/
public function updateExtensionInformation()
{
$connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_terfe2_domain_model_extension');
$connection->update(
'tx_terfe2_domain_model_extension',
[
'tstamp' => $GLOBALS['SIM_EXEC_TIME'],
'versions' => $this->getNumberOfVersions(),
'last_version' => $this->getHighestVersion()
],
[
'ext_key' => $this->extensionKey
]
);
}
/**
* Gets the highest version number (UID) of the extension
*/
protected function getHighestVersion(): int
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_terfe2_domain_model_version');
$queryBuilder->getRestrictions()->removeAll();
$res = $queryBuilder
->select('uid', 'version_number')
->from('tx_terfe2_domain_model_version')
->where(
$queryBuilder->expr()->eq('deleted', 0),
$queryBuilder->expr()->eq('extension', $this->getUid())
)
->orderBy('version_number', 'DESC')
->setMaxResults(1)
->execute()
->fetch();
if (!empty($res)) {
return (int)$res['uid'];
}
return 0;
}
protected function getNumberOfVersions(): int
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_terfe2_domain_model_version');
$queryBuilder->getRestrictions()->removeAll();
return $queryBuilder
->count('uid')
->from('tx_terfe2_domain_model_version')
->where(
$queryBuilder->expr()->eq('extension', $this->getUid()),
$queryBuilder->expr()->eq('deleted', 0)
)
->execute()
->fetchColumn();
}
/**
* @todo: this method does not belong here, should be moved to a different location and return objects in the future
*
......
......@@ -275,6 +275,15 @@ class ExtensionVersion
@unlink($fullPathPrefix . $file);
}
}
// Reset the information about the current latest uploaded version of the extension
$this->extensionKey->updateExtensionInformation();
// remove from index queue, if there are no more versions
if (!$this->extensionKey->hasUploadedVersions() && ExtensionManagementUtility::isLoaded('solr')) {
$indexQueue = GeneralUtility::makeInstance(Queue::class);
$indexQueue->deleteItem('tx_terfe2_domain_model_extension', $this->extensionKey->getUid());
}
}
/**
......@@ -551,7 +560,7 @@ class ExtensionVersion
$this->addRelations($versionUid, $dependenciesArr);
}
$this->updateExtension($versionUid, $extUid);
$this->extensionKey->updateExtensionInformation();
// update the EXT:solr Index Queue
if (ExtensionManagementUtility::isLoaded('solr')) {
......@@ -628,47 +637,6 @@ class ExtensionVersion
}
}
/**
* @param int $versionUid
* @param int $extUid
*/
protected function updateExtension($versionUid, $extUid)
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_terfe2_domain_model_extension');
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder
->update('tx_terfe2_domain_model_extension')
->set('tstamp', $GLOBALS['SIM_EXEC_TIME'])
->set('versions', $this->getNumberOfVersions($extUid))
->set('last_version', $this->calculatedHighestVersion($versionUid, $extUid))
->where(
$queryBuilder->expr()->eq('ext_key', (string)$this->extensionKey)
)
->execute();
}
/**
* @param int $extUid
* @return int $numberOfVersions
*/
protected function getNumberOfVersions(int $extUid): int
{
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$queryBuilder = $connectionPool->getQueryBuilderForTable('tx_terfe2_domain_model_version');
$queryBuilder->getRestrictions()->removeAll();
return $queryBuilder
->count('uid')
->from('tx_terfe2_domain_model_version')
->where(
$queryBuilder->expr()->eq('extension', $extUid),
$queryBuilder->expr()->eq('deleted', 0)
)
->execute()
->fetchColumn();
}
/**
* @param int $versionUid
* @param array $dependencies
......@@ -825,75 +793,4 @@ class ExtensionVersion
$maximum = (!empty($maximum) ? VersionNumberUtility::convertVersionNumberToInteger($maximum) : 0);
return [$minimum, $maximum];
}
/**
* Check which version is higher, so that we can se the right version in latest_version
*
* @param $versionUid
* @param $extUid
* @return int
*/
private function calculatedHighestVersion($versionUid, $extUid): int
{
$currentHighestVersion = $this->getHighestVersion($extUid);
if (empty($currentHighestVersion)) {
return $versionUid;
}
$newVersionNumber = $this->getVersionNumber($versionUid);
if ($newVersionNumber < $currentHighestVersion['version_number']) {
$versionUid = $currentHighestVersion['uid'];
}
return $versionUid;
}
/**
* Get the version number of the current version
*
* @param $versionUid
* @return int
*/
private function getVersionNumber($versionUid)
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_terfe2_domain_model_version');
$queryBuilder->getRestrictions()->removeAll();
return (int)$queryBuilder
->select('version_number')
->from('tx_terfe2_domain_model_version')
->where(
$queryBuilder->expr()->eq('deleted', 0),
$queryBuilder->expr()->eq('uid', $versionUid)
)
->execute()
->fetchColumn();
}
/**
* Gets the highest version number
*
* @param $extUid
*
* @return array|false|null
*/
private function getHighestVersion($extUid): array
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_terfe2_domain_model_version');
$queryBuilder->getRestrictions()->removeAll();
$res = $queryBuilder
->select('uid', 'version_number')
->from('tx_terfe2_domain_model_version')
->where(
$queryBuilder->expr()->eq('deleted', 0),
$queryBuilder->expr()->eq('extension', $extUid)
)
->orderBy('version_number', 'DESC')
->execute()
->fetch();
if (!empty($res)) {
return $res;
}
return [];
}
}
......@@ -16,56 +16,56 @@ namespace T3o\Ter\Api;
*/
class ResultCodes
{
public const ERROR_GENERAL_EXTREPDIRDOESNTEXIST = '100';
public const ERROR_GENERAL_NOUSERORPASSWORD = '101';
public const ERROR_GENERAL_USERNOTFOUND = '102';
public const ERROR_GENERAL_WRONGPASSWORD = '103';
public const ERROR_GENERAL_DATABASEERROR = '104';
public const ERROR_GENERAL_EXTENSIONCONTAINSNOFILES = '105';
public const ERROR_GENERAL_EXTREPDIRDOESNTEXIST = 100;
public const ERROR_GENERAL_NOUSERORPASSWORD = 101;
public const ERROR_GENERAL_USERNOTFOUND = 102;
public const ERROR_GENERAL_WRONGPASSWORD = 103;
public const ERROR_GENERAL_DATABASEERROR = 104;
public const ERROR_GENERAL_EXTENSIONCONTAINSNOFILES = 105;
public const ERROR_UPLOADEXTENSION_EXTENSIONDOESNTEXIST = '202';
public const ERROR_UPLOADEXTENSION_EXTENSIONCONTAINSNOFILES = '203';
public const ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGFILES = '204';
public const ERROR_UPLOADEXTENSION_EXTENSIONTOOBIG = '205';
public const ERROR_UPLOADEXTENSION_EXISTINGEXTENSIONRECORDNOTFOUND = '206';
public const ERROR_UPLOADEXTENSION_FILEMD5DOESNOTMATCH = '207';
public const ERROR_UPLOADEXTENSION_ACCESSDENIED = '208';
public const ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYINCORRECT = '209';
public const ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYCHECKFAILED = '210';
public const ERROR_UPLOADEXTENSION_EXTENSIONVERSIONEXISTS = '211';
public const ERROR_UPLOADEXTENSION_NOUPLOADCOMMENT = '212';
public const ERROR_UPLOADEXTENSION_EXTENSIONDOESNTEXIST = 202;
public const ERROR_UPLOADEXTENSION_EXTENSIONCONTAINSNOFILES = 203;
public const ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGFILES = 204;
public const ERROR_UPLOADEXTENSION_EXTENSIONTOOBIG = 205;
public const ERROR_UPLOADEXTENSION_EXISTINGEXTENSIONRECORDNOTFOUND = 206;
public const ERROR_UPLOADEXTENSION_FILEMD5DOESNOTMATCH = 207;
public const ERROR_UPLOADEXTENSION_ACCESSDENIED = 208;
public const ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYINCORRECT = 209;
public const ERROR_UPLOADEXTENSION_TYPO3DEPENDENCYCHECKFAILED = 210;
public const ERROR_UPLOADEXTENSION_EXTENSIONVERSIONEXISTS = 211;
public const ERROR_UPLOADEXTENSION_NOUPLOADCOMMENT = 212;
public const ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY = '300';
public const ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY = 300;
public const ERROR_DELETEEXTENSIONKEY_ACCESSDENIED = '500';
public const ERROR_DELETEEXTENSIONKEY_KEYDOESNOTEXIST = '501';
public const ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST = '502';
public const ERROR_DELETEEXTENSIONKEY_ACCESSDENIED = 500;
public const ERROR_DELETEEXTENSIONKEY_KEYDOESNOTEXIST = 501;
public const ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST = 502;
public const ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED = '600';
public const ERROR_MODIFYEXTENSIONKEY_SETTINGTOTHISOWNERISNOTPOSSIBLE = '601';
public const ERROR_MODIFYEXTENSIONKEY_KEYDOESNOTEXIST = '602';
public const ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED = 600;
public const ERROR_MODIFYEXTENSIONKEY_SETTINGTOTHISOWNERISNOTPOSSIBLE = 601;
public const ERROR_MODIFYEXTENSIONKEY_KEYDOESNOTEXIST = 602;
public const ERROR_SETREVIEWSTATE_NOUSERGROUPDEFINED = '700';
public const ERROR_SETREVIEWSTATE_ACCESSDENIED = '701';
public const ERROR_SETREVIEWSTATE_EXTENSIONVERSIONDOESNOTEXIST = '702';
public const ERROR_SETREVIEWSTATE_NOUSERGROUPDEFINED = 700;
public const ERROR_SETREVIEWSTATE_ACCESSDENIED = 701;
public const ERROR_SETREVIEWSTATE_EXTENSIONVERSIONDOESNOTEXIST = 702;
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_NOUSERGROUPDEFINED = '800';
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_ACCESSDENIED = '801';
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONVERSIONDOESNOTEXIST = '802';
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_INCREMENTORNOTPOSITIVEINTEGER = '803';
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONKEYDOESNOTEXIST = '804';
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_NOUSERGROUPDEFINED = 800;
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_ACCESSDENIED = 801;
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONVERSIONDOESNOTEXIST = 802;
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_INCREMENTORNOTPOSITIVEINTEGER = 803;
public const ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONKEYDOESNOTEXIST = 804;
public const ERROR_DELETEEXTENSION_ACCESS_DENIED = '900';
public const ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST = '901';
public const ERROR_DELETEEXTENSION_ACCESS_DENIED = 900;
public const ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST = 901;
// Result codes:
public const RESULT_GENERAL_OK = '10000';
public const RESULT_ERRORS_OCCURRED = '10001';
public const RESULT_GENERAL_OK = 10000;
public const RESULT_ERRORS_OCCURRED = 10001;
public const RESULT_EXTENSIONKEYALREADYEXISTS = '10500';
public const RESULT_EXTENSIONKEYDOESNOTEXIST = '10501';
public const RESULT_EXTENSIONKEYNOTVALID = '10502';
public const RESULT_EXTENSIONKEYSUCCESSFULLYREGISTERED = '10503';
public const RESULT_EXTENSIONSUCCESSFULLYUPLOADED = '10504';
public const RESULT_EXTENSIONSUCCESSFULLYDELETED = '10505';
public const RESULT_EXTENSIONKEYALREADYEXISTS = 10500;
public const RESULT_EXTENSIONKEYDOESNOTEXIST = 10501;
public const RESULT_EXTENSIONKEYNOTVALID = 10502;
public const RESULT_EXTENSIONKEYSUCCESSFULLYREGISTERED = 10503;
public const RESULT_EXTENSIONSUCCESSFULLYUPLOADED = 10504;
public const RESULT_EXTENSIONSUCCESSFULLYDELETED = 10505;
}
<?php
namespace T3o\Ter\Soap;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -12,15 +14,22 @@
* The TYPO3 project - inspiring people to share!
*/
/**
* SOAP server for the TYPO3 Extension Repository
*
* @author Robert Lemke <robert@typo3.org>
*/
use Psr\Log\LoggerAwareTrait;
use T3o\Ter\Api\ApiUser;
use T3o\Ter\Api\ExtensionKey;
use T3o\Ter\Api\ExtensionVersion;
use T3o\Ter\Api\ResultCodes;
use T3o\Ter\Exception\Exception;
use T3o\Ter\Exception\ExtensionKeyAlreadyInUseException;
use T3o\Ter\Exception\ExtensionKeyNotFoundException;
use T3o\Ter\Exception\InternalServerErrorException;
use T3o\Ter\Exception\InvalidExtensionKeyFormatException;
use T3o\Ter\Exception\NotFoundException;
use T3o\Ter\Exception\UnauthorizedException;
use T3o\Ter\Exception\UserNotFoundException;
use T3o\Ter\Exception\VersionExistsException;
use T3o\TerFe2\Service\ExtensionIndexService;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -28,13 +37,13 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*
* @author Robert Lemke <robert@typo3.org>
*/
class tx_ter_api
class TerSoapV1Handler
{
use \Psr\Log\LoggerAwareTrait;
use LoggerAwareTrait;
public function __construct()
{
$this->setLogger(GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger('TER\API\SOAP'));
$this->setLogger(GeneralUtility::makeInstance(LogManager::class)->getLogger('TER\API\SOAP'));
}
/*********************************************************
......@@ -71,7 +80,7 @@ class tx_ter_api
try {
$user = ApiUser::createFromSoapAccountData($accountData);
$user->authenticate();
} catch (\T3o\Ter\Exception\UnauthorizedException $e) {
} catch (UnauthorizedException $e) {
return false;
}
return $user->isAuthenticated();
......@@ -85,8 +94,8 @@ class tx_ter_api
* @param object $filesData : The array of file data objects as received by the SOAP server
*
* @return array|object uploadExtensionResult object if upload was successful, otherwise an exception is thrown.
* @throws \T3o\Ter\Exception\Exception
* @throws \T3o\Ter\Exception\VersionExistsException
* @throws Exception
* @throws VersionExistsException
* @access public
* @since 2.0.0
*/
......@@ -110,14 +119,14 @@ class tx_ter_api
$this->logger->info('Upload of extension ' . ((string)$extensionKey) . ' (' . $version->getVersion() . ') by user ' . $user->getUsername());
if ($version->doesExtensionVersionExist()) {
throw new \T3o\Ter\Exception\VersionExistsException(
throw new VersionExistsException(
'Version number ' . htmlspecialchars($version->getVersion()) . ' already exists in repository.',
ResultCodes::ERROR_UPLOADEXTENSION_EXTENSIONVERSIONEXISTS
);
}
if (!is_array($filesData->fileData)) {
throw new \T3o\Ter\Exception\NotFoundException('Extension contains no files.', ResultCodes::ERROR_GENERAL_EXTENSIONCONTAINSNOFILES);
throw new NotFoundException('Extension contains no files.', ResultCodes::ERROR_GENERAL_EXTENSIONCONTAINSNOFILES);
}
$version->upload($user, $extensionInfoData, $filesData->fileData);
$this->requestUpdateOfExtensionIndexFile();
......@@ -139,8 +148,8 @@ class tx_ter_api
* @param string $version : Version string of the extension version to delete
*
* @return array|object simpleResult object if extension could be deleted, otherwise an exception is thrown.
* @throws \T3o\Ter\Exception\UnauthorizedException
* @throws \T3o\Ter\Exception\NotFoundException
* @throws UnauthorizedException
* @throws NotFoundException
* @access public
* @since 2.0.1
*/
......@@ -153,7 +162,7 @@ class tx_ter_api
$extensionKeyObject = new ExtensionKey($extensionKey);
if (!$extensionKeyObject->isRegistered()) {
throw new \T3o\Ter\Exception\NotFoundException(
throw new NotFoundException(
'Extension does not exist.',
ResultCodes::ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST
);
......@@ -211,13 +220,13 @@ class tx_ter_api
$registerExtensionKeyData->ownerUsername ?? $user->getUsername()
);
$resultCode = ResultCodes::RESULT_EXTENSIONKEYSUCCESSFULLYREGISTERED;
} catch (\T3o\Ter\Exception\InvalidExtensionKeyFormatException $e) {
} catch (InvalidExtensionKeyFormatException $e) {
$resultCode = ResultCodes::RESULT_EXTENSIONKEYNOTVALID;
} catch (\T3o\Ter\Exception\UnauthorizedException $e) {
} catch (UnauthorizedException $e) {
$resultCode = $e->getCode();
} catch (\T3o\Ter\Exception\UserNotFoundException $e) {
} catch (UserNotFoundException $e) {
$resultCode = ResultCodes::ERROR_GENERAL_USERNOTFOUND;
} catch (\T3o\Ter\Exception\ExtensionKeyAlreadyInUseException $e) {
} catch (ExtensionKeyAlreadyInUseException $e) {
$resultCode = ResultCodes::RESULT_EXTENSIONKEYALREADYEXISTS;
}
return $this->formatAsSimpleResult($resultCode);
......@@ -267,8 +276,8 @@ class tx_ter_api
* @return array|object simpleResponse-object. An exception is thrown if a fatal error occurred.
* @access public
* @since 2.0.0
* @throws \T3o\Ter\Exception\InternalServerErrorException
* @throws \T3o\Ter\Exception\UnauthorizedException
* @throws InternalServerErrorException
* @throws UnauthorizedException
*/
public function deleteExtensionKey($accountData, $extensionKey)
{
......@@ -280,7 +289,7 @@ class tx_ter_api
try {
$extensionKeyObject->unregister($user);
$resultCode = ResultCodes::RESULT_GENERAL_OK;
} catch (\T3o\Ter\Exception\VersionExistsException $e) {
} catch (VersionExistsException $e) {
$resultCode = ResultCodes::ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST;
}
} else {
......@@ -299,7 +308,7 @@ class tx_ter_api
* @return array|object simpleResponse-object. An exception is thrown if a fatal error occurred.
* @access public
* @since 2.0.0
* @throws \T3o\Ter\Exception\UnauthorizedException
* @throws UnauthorizedException
*/
public function modifyExtensionKey($accountData, $modifyExtensionKeyData)
{
......@@ -318,11 +327,11 @@ class tx_ter_api
);
$this->requestUpdateOfExtensionIndexFile();
$resultCode = ResultCodes::RESULT_GENERAL_OK;
} catch (\T3o\Ter\Exception\UnauthorizedException $e) {
throw new \T3o\Ter\Exception\UnauthorizedException('Access denied.', ResultCodes::ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED);
} catch (\T3o\Ter\Exception\UserNotFoundException $e) {
} catch (UnauthorizedException $e) {
throw new UnauthorizedException('Access denied.', ResultCodes::ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED);
} catch (UserNotFoundException $e) {
$resultCode = $e->getCode();
} catch (\T3o\Ter\Exception\ExtensionKeyNotFoundException $e) {
} catch (ExtensionKeyNotFoundException $e