[TASK] Doctrine: Migrate ext:linkvalidator/Task 39/48539/5
authorIan SEBBAGH <ianouf@gmail.com>
Thu, 9 Jun 2016 12:47:32 +0000 (14:47 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 17 Jun 2016 08:54:08 +0000 (10:54 +0200)
Resolves: #76556
Releases: master
Change-Id: I9cca5e3859af7520996b54d587d98dea960cfa87
Reviewed-on: https://review.typo3.org/48539
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php

index 9fd3608..405a8a3 100644 (file)
@@ -312,7 +312,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
         if ($page === 0) {
             $rootLineHidden = false;
         } else {
-            $pageRow = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'pages', 'uid=' . $page);
+            $pageRow = BackendUtility::getRecord('pages', $page, '*', '', false);
             $rootLineHidden = $processor->getRootLineIsHidden($pageRow);
         }
         if (!$rootLineHidden || $modTs['checkhidden'] == 1) {
@@ -600,12 +600,4 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
     {
         return $GLOBALS['LANG'];
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
index 8290653..ae26ed2 100644 (file)
@@ -202,16 +202,9 @@ class ValidatorTaskAdditionalFieldProvider implements AdditionalFieldProviderInt
                 }
             }
         }
-        if ($res = $this->getDatabaseConnection()->exec_SELECTquery('*', 'pages', 'uid = ' . (int)$submittedData['linkvalidator']['page'])) {
-            if ($this->getDatabaseConnection()->sql_num_rows($res) == 0 && $submittedData['linkvalidator']['page'] > 0) {
-                $isValid = false;
-                $schedulerModule->addMessage(
-                    $lang->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.invalidPage'),
-                    FlashMessage::ERROR
-                );
-            }
-            $this->getDatabaseConnection()->sql_free_result($res);
-        } else {
+
+        $row = BackendUtility::getRecord('pages', (int)$submittedData['linkvalidator']['page'], '*', '', false);
+        if (empty($row)) {
             $isValid = false;
             $schedulerModule->addMessage(
                 $lang->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.invalidPage'),
@@ -258,12 +251,4 @@ class ValidatorTaskAdditionalFieldProvider implements AdditionalFieldProviderInt
     {
         return $GLOBALS['LANG'];
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }