Commit 68b7290c authored by Thomas Löffler's avatar Thomas Löffler

Add quality information to extension and Solr

parent f2a40ba7
Pipeline #7066 passed with stages
in 5 minutes and 1 second
......@@ -198,6 +198,7 @@ class ExtensionRepository extends \T3o\TerFe2\Domain\Repository\AbstractReposito
$constraints = [];
$constraints[] = $query->greaterThan('versions', 0);
$constraints[] = $query->equals('versions.codeQuality', 0);
$query->setOrderings(['versions.uploadDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING]);
return $query->matching($query->logicalAnd($constraints))->execute();
}
......
......@@ -75,6 +75,13 @@
</f:link.external>
</li>
</f:if>
<f:if condition="{document.codeQuality_tIntS} == 2">
<li class="list-inline-item">
<f:link.external class="badge badge-success" uri="https://ter-sonarqube.marketing-factory.de/dashboard?id={document.extensionKey_stringS}" rel="nofollow">
<i class="fa fa-thumbs-o-up"></i> Code Quality
</f:link.external>
</li>
</f:if>
</ul>
</div>
</div>
......
......@@ -11,21 +11,11 @@ class CodeQualityCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Com
*/
protected $extensionRepository;
/**
* @var \ApacheSolrForTypo3\Solr\IndexQueue\Queue
*/
protected $solrIndexQueue;
public function injectExtensionRepository(\T3o\TerFe2\Domain\Repository\ExtensionRepository $extensionRepository)
{
$this->extensionRepository = $extensionRepository;
}
public function injectSolrIndexQueue(\ApacheSolrForTypo3\Solr\IndexQueue\Queue $queue)
{
$this->solrIndexQueue = $queue;
}
/**
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
......@@ -35,15 +25,23 @@ class CodeQualityCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Com
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->extensionRepository->setDefaultQuerySettings($querySettings);
$solrIndexQueue = $this->objectManager->get(\ApacheSolrForTypo3\Solr\IndexQueue\Queue::class);
$extensionsWithVersion = $this->extensionRepository->findAllWithVersionAndWithoutQualityCheck();
foreach ($extensionsWithVersion as $extension) {
if ($extension->getLastVersion()->getCodeQuality() === Version::CODE_QUALITY_UNCHECKED) {
foreach ($extensionsWithVersion as $key => $extension) {
if ($extension->getLastVersion() instanceof Version && $extension->getLastVersion()->getCodeQuality() === Version::CODE_QUALITY_UNCHECKED) {
$codeQuality = CodeQualityService::hasExtensionVersionGoodQuality($extension->getLastVersion());
$extension->getLastVersion()->setCodeQuality($codeQuality);
$this->extensionRepository->update($extension);
if ($codeQuality !== Version::CODE_QUALITY_UNCHECKED) {
$extension->getLastVersion()->setCodeQuality($codeQuality);
$this->extensionRepository->update($extension);
$solrIndexQueue->updateItem('tx_terfe2_domain_model_extension', $extension->getUid());
}
}
$this->solrIndexQueue->updateItem('tx_terfe2_domain_model_extension', $extension->getUid());
if ($key % 50 === 0) {
$persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
$persistenceManager->persistAll();
}
}
......
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