[TASK] Doctrine: migrate EXT:beuser PermissionController 75/48775/4
authorMichael Oehlhof <typo3@oehlhof.de>
Fri, 1 Jul 2016 21:32:27 +0000 (23:32 +0200)
committerBenni Mack <benni@typo3.org>
Thu, 7 Jul 2016 05:18:58 +0000 (07:18 +0200)
Resolves: #76917
Releases: master
Change-Id: I0faa3d5dfb2c05c1b2284f20fb0e7a823300c72a
Reviewed-on: https://review.typo3.org/48775
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/beuser/Classes/Controller/PermissionController.php

index be09d9e..4991a95 100644 (file)
@@ -18,7 +18,7 @@ use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\Tree\View\PageTreeView;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\View\BackendTemplateView;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -120,8 +120,9 @@ class PermissionController extends ActionController
         $view->assign(
             'previewUrl',
             BackendUtility::viewOnClick(
-                $this->pageInfo['uid'], '',
-                BackendUtility::BEgetRootLine($this->pageInfo['uid'])
+                (int)$this->pageInfo['uid'],
+                '',
+                BackendUtility::BEgetRootLine((int)$this->pageInfo['uid'])
             )
         );
 
@@ -333,18 +334,20 @@ class PermissionController extends ActionController
                 if ((int)$properties['perms_groupid'] === -1) {
                     unset($properties['perms_groupid']);
                 }
-                $this->getDatabaseConnection()->exec_UPDATEquery(
+                $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages');
+                $connection->update(
                     'pages',
-                    'uid = ' . (int)$pageUid,
-                    $properties
+                    $properties,
+                    ['uid' => (int)$pageUid]
                 );
+
                 if (!empty($mirror['pages'][$pageUid])) {
                     $mirrorPages = GeneralUtility::trimExplode(',', $mirror['pages'][$pageUid]);
                     foreach ($mirrorPages as $mirrorPageUid) {
-                        $this->getDatabaseConnection()->exec_UPDATEquery(
+                        $connection->update(
                             'pages',
-                            'uid = ' . (int)$mirrorPageUid,
-                            $properties
+                            $properties,
+                            ['uid' => (int)$mirrorPageUid]
                         );
                     }
                 }
@@ -362,14 +365,6 @@ class PermissionController extends ActionController
     }
 
     /**
-     * @return DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
-    /**
      * Finding tree and offer setting of values recursively.
      *
      * @return array