[TASK] Doctrine: migrate ext:belog 28/47628/7
authorJan Helke <typo3@helke.de>
Tue, 12 Apr 2016 15:50:03 +0000 (17:50 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 13 Apr 2016 15:56:16 +0000 (17:56 +0200)
Resolves: #75549
Releases: master
Change-Id: Icfe6d3f47073e4dbd3636d6c435f946bfd6ee444
Reviewed-on: https://review.typo3.org/47628
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/belog/Classes/Controller/SystemInformationController.php

index 8372af2..c018a24 100644 (file)
@@ -14,10 +14,13 @@ namespace TYPO3\CMS\Belog\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus;
 use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem;
+use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Belog\Domain\Model\Constraint;
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Query\QueryBuilder;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 
 /**
@@ -48,7 +51,14 @@ class SystemInformationController extends AbstractController
 
         $this->setStartAndEndTimeFromTimeSelector($constraint);
         // we can't use the extbase repository here as the required TypoScript may not be parsed yet
-        $count = $this->getDatabaseConnection()->exec_SELECTcountRows('error', 'sys_log', 'tstamp >= ' . $timestamp . ' AND error IN(-1,1,2)');
+        /** @var QueryBuilder $queryBuilder */
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_log');
+        $count = $queryBuilder->count('error')
+            ->from('sys_log')
+            ->where($queryBuilder->expr()->gte('tstamp', $timestamp))
+            ->andWhere($queryBuilder->expr()->in('error', [-1, 1, 2]))
+            ->execute()
+            ->fetchColumn(0);
 
         if ($count > 0) {
             $systemInformationToolbarItem->addSystemMessage(
@@ -81,12 +91,4 @@ class SystemInformationController extends AbstractController
     {
         return $GLOBALS['BE_USER'];
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }