Commit 3d4a6f88 authored by Andreas Wolf's avatar Andreas Wolf

[TASK] #279: Replace sysLog calls w/ logging framework

parent e7cce7f9
......@@ -15,7 +15,9 @@ namespace T3o\TerFe2\Task;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Log\LoggerInterface;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Extbase\Scheduler\Task;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
......@@ -36,6 +38,12 @@ class ImportExtensionsFromQueueTask extends Task
*/
protected $pidExtensions = 2;
/**
* @var LoggerInterface
*/
protected $logger;
/**
* executes the importer
*
......@@ -43,11 +51,13 @@ class ImportExtensionsFromQueueTask extends Task
*/
public function execute()
{
$this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
$extensionsFromQueue = $this->getExtensionsFromQueue();
// finish task if no extensions in queue
if (empty($extensionsFromQueue)) {
GeneralUtility::sysLog('No new extensions in queue table', 'ter_fe2', 1);
$this->logger->info('No new extensions in queue table');
return true;
}
......@@ -57,11 +67,10 @@ class ImportExtensionsFromQueueTask extends Task
if (!$this->versionExists($extensionData)) {
$extUid = $this->extensionExists($extensionData);
$this->saveExtension($extUid, $extensionData, $ext['crdate']);
GeneralUtility::sysLog(
'Extension "' . $extensionData['extensionkey'] . '", version ' . $extensionData['version'] . ' saved in ter_fe2',
'ter_fe2',
1
);
$this->logger->info(sprintf(
'Extension "%s" version %s saved in ter_fe2',
$extensionData['extensionkey'], $extensionData['version']
));
// update the EXT:solr Index Queue
if (ExtensionManagementUtility::isLoaded('solr')) {
......@@ -69,11 +78,10 @@ class ImportExtensionsFromQueueTask extends Task
$indexQueue->updateItem('tx_terfe2_domain_model_extension', $extUid);
}
}
GeneralUtility::sysLog(
'Extension "' . $extensionData['extensionkey'] . '" still exists with version ' . $extensionData['version'] . ' in ter_fe2',
'ter_fe2',
1
);
$this->logger->info(sprintf(
'Extension "%s" still exists in ter_fe2 with version %s',
$extensionData['extensionkey'], $extensionData['version']
));
$this->removeExtensionFromQueue($ext['extensionuid']);
}
......
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