Commit 4f4fe900 authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Remove unused code in TER API and use modern APIs

The tx_ter_api class is cleaned up as follows:

* Use PSR-3 logging mechanisms instead of TYPO3_DLOG constants
* Remove reference to cObj as it is not needed at all
* Remove calls to empty protected methods as they are not needed anymore
* Remove non-existant definition for tx_ter_extensionqueue.hidden (DB field does not exist)
parent a5e5bf87
Pipeline #9056 passed with stages
in 5 minutes and 33 seconds
......@@ -25,16 +25,9 @@ return [
'dividers2tabs' => true,
],
'interface' => [
'showRecordFieldList' => 'hidden, extensionkey, extensionuid, imported_to_fe',
'showRecordFieldList' => 'extensionkey, extensionuid, imported_to_fe',
],
'columns' => [
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'extensionkey' => [
'label' => 'LLL:EXT:ter/locallang_tca.xml:tx_ter_extensionqueue.extensionkey',
'config' => [
......
......@@ -29,6 +29,8 @@ require_once(ExtensionManagementUtility::extPath('ter') . 'class.tx_ter_helper.p
*/
class tx_ter_api
{
use \Psr\Log\LoggerAwareTrait;
/**
* @var tx_ter_helper
*/
......@@ -39,11 +41,6 @@ class tx_ter_api
*/
protected $parentObj;
/**
* @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
*/
protected $cObj;
/**
* @var \TYPO3\CMS\Core\DataHandling\DataHandler
*/
......@@ -67,7 +64,7 @@ class tx_ter_api
{
$this->helperObj = new tx_ter_helper($parentObj);
$this->parentObj = $parentObj;
$this->cObj = $parentObj->cObj;
$this->setLogger(GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger('TER\API\SOAP'));
}
/*********************************************************
......@@ -131,14 +128,7 @@ class tx_ter_api
$extensionInfoData->technicalData->dependencies = [$extensionInfoData->technicalData->dependencies];
}
$extensionKey = strtolower($extensionInfoData->extensionKey);
if (TYPO3_DLOG) {
GeneralUtility::devLog(
'tx_ter_api->uploadExtension()',
'ter',
0,
'Upload of extension ' . $extensionKey . ' (' . $extensionInfoData->version . ') by user ' . $accountData->username
);
}
$this->logger->info('Upload of extension ' . $extensionKey . ' (' . $extensionInfoData->version . ') by user ' . $accountData->username);
$uploadUserRecordArr = $this->helperObj->getValidUser($accountData);
$extensionKeyRecordArr = $this->helperObj->getExtensionKeyRecord($extensionKey);
......@@ -193,8 +183,6 @@ class tx_ter_api
$this->uploadExtension_writeExtensionInfoToDB($accountData, $extensionInfoData, $filesData);
$this->helperObj->requestUpdateOfExtensionIndexFile();
static::notifyExtensionVersionUpload($extensionInfoData);
return [
'resultCode' => TX_TER_RESULT_EXTENSIONSUCCESSFULLYUPLOADED,
'resultMessages' => [
......@@ -204,18 +192,6 @@ class tx_ter_api
];
}
/**
* notify message queue server of uploaded extension
*
* has to be static because uploadExtensionWithoutSoap() is static
*
* @param $extensionInfoData
* @deprecated The method used to notifiy via Tx_Amqp_Service_ProducerService, which is no longer available
*/
protected static function notifyExtensionVersionUpload($extensionInfoData)
{
}
/**
* Method for manually uploading an extension to the repository
*
......@@ -234,7 +210,6 @@ class tx_ter_api
// Make an instance of the api
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ter']);
$dummyParentObject = (object)[
'cObj' => GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class),
'extensionsPID' => $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_ter_pi1.']['pid'],
'repositoryDir' => $extConf['repositoryDir'],
'conf' => $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_ter_pi1.'],
......@@ -278,8 +253,6 @@ class tx_ter_api
$instance->uploadExtension_writeExtensionInfoToDB($accountData, $extensionInfoData, $filesData);
$instance->helperObj->requestUpdateOfExtensionIndexFile();
static::notifyExtensionVersionUpload($extensionInfoData);
return true;
}
......@@ -298,14 +271,7 @@ class tx_ter_api
*/
public function deleteExtension($accountData, $extensionKey, $version)
{
if (TYPO3_DLOG) {
GeneralUtility::devLog(
'tx_ter_api->deleteExtension()',
'ter',
0,
'Deletion of extension ' . $extensionKey . ' (' . $version . ') by user ' . $accountData->username
);
}
$this->logger->info('Deletion of extension ' . $extensionKey . ' (' . $version . ') by user ' . $accountData->username);
$userRecordArr = $this->helperObj->getValidUser($accountData);
if ($userRecordArr['admin'] !== true) {
......@@ -374,7 +340,6 @@ class tx_ter_api
$this->registerExtensionKey_writeExtensionKeyInfoToDB($accountData, $registerExtensionKeyData);
$resultCode = TX_TER_RESULT_EXTENSIONKEYSUCCESSFULLYREGISTERED;
} else {
$this->notifyExtensionKeyRegistration($registerExtensionKeyData);
$resultCode = TX_TER_RESULT_EXTENSIONKEYALREADYEXISTS;
}
} else {
......@@ -387,17 +352,6 @@ class tx_ter_api
];
}
/**
* notify message queue server of registered extension key
*
* @param $registerExtensionKeyData
* @return mixed
* @deprecated The method used to notifiy via Tx_Amqp_Service_ProducerService, which is no longer available
*/
protected function notifyExtensionKeyRegistration($registerExtensionKeyData)
{
}
/**
* Returns a list of extension key records filtered by certain
* criteria.
......@@ -518,7 +472,6 @@ class tx_ter_api
}
$resultCode = TX_TER_RESULT_GENERAL_OK;
$this->notifyExtensionKeyDelete($extensionKey);
}
} else {
throw new \T3o\Ter\Exception\InternalServerErrorException(
......@@ -536,17 +489,6 @@ class tx_ter_api
];
}
/**
* notify message queue server of deleted extension key
*
* @param $extensionKey
* @return mixed
* @deprecated The method used to notifiy via Tx_Amqp_Service_ProducerService, which is no longer available
*/
protected function notifyExtensionKeyDelete($extensionKey)
{
}
/**
* Modifies an extension key.
*
......
......@@ -39,7 +39,6 @@ use TYPO3\CMS\Frontend\Plugin\AbstractPlugin;
*/
class tx_ter_pi1 extends AbstractPlugin
{
public $cObj; // Standard cObj (parent)
public $extensionsPID; // Start page for extension records
public $wsdlNamespace; // Namespace
public $repositoryDir; // Absolute path to extension repository directory
......
Supports Markdown
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