[!!!][TASK] Migrate sys_notes away from extbase 04/55804/6
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 19 Feb 2018 18:32:24 +0000 (19:32 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 28 Feb 2018 13:47:45 +0000 (14:47 +0100)
Simplify the sys_note handling by removing extbase from it

Resolves: #84055
Releases: master
Change-Id: Ib41d5e88c7ec9d79ee23dc913c3dc1ee0184c372
Reviewed-on: https://review.typo3.org/55804
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
19 files changed:
typo3/sysext/core/Documentation/Changelog/9.0/Breaking-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/9.0/Deprecation-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst [deleted file]
typo3/sysext/core/Documentation/Changelog/master/Breaking-84055-MigrateSys_notesAwayFromExtbase.rst [new file with mode: 0644]
typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/sys_note/Classes/Controller/NoteController.php
typo3/sysext/sys_note/Classes/Core/Bootstrap.php [deleted file]
typo3/sysext/sys_note/Classes/Domain/Model/SysNote.php [deleted file]
typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php
typo3/sysext/sys_note/Classes/Hook/InfoModuleHook.php
typo3/sysext/sys_note/Classes/Hook/PageHook.php
typo3/sysext/sys_note/Classes/Hook/RecordListHook.php
typo3/sysext/sys_note/Configuration/TypoScript/constants.txt [deleted file]
typo3/sysext/sys_note/Configuration/TypoScript/setup.txt [deleted file]
typo3/sysext/sys_note/Resources/Private/Layouts/Default.html [deleted file]
typo3/sysext/sys_note/Resources/Private/Templates/Note/List.html
typo3/sysext/sys_note/ext_localconf.php
typo3/sysext/sys_note/ext_typoscript_constants.txt [deleted file]
typo3/sysext/sys_note/ext_typoscript_setup.txt [deleted file]

diff --git a/typo3/sysext/core/Documentation/Changelog/9.0/Breaking-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst b/typo3/sysext/core/Documentation/Changelog/9.0/Breaking-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst
new file mode 100644 (file)
index 0000000..54b6e50
--- /dev/null
@@ -0,0 +1,35 @@
+.. include:: ../../Includes.txt
+
+===========================================================================
+Breaking: #82506 - Remove BackendUserRepository injection in NoteController
+===========================================================================
+
+See :issue:`82506`
+
+Description
+===========
+
+To improve the performance of showing sys_note records the injection of the :php:`BackendUserRepository` has been
+removed in :php:`\TYPO3\CMS\SysNote\Controller\NoteController`.
+
+
+Impact
+======
+
+The method :php:`\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository::findByPidsAndAuthor` has been removed.
+
+
+Affected Installations
+======================
+
+Any installation using third-party extension that use the method
+:php:`\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository::findByPidsAndAuthor`.
+
+
+Migration
+=========
+
+Use the method :php:`\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository::findByPidsAndAuthorId`, and use the
+user id as 2nd argument instead of a `BackendUser` object.
+
+.. index:: Backend, PHP-API, FullyScanned, ext:sys_note
diff --git a/typo3/sysext/core/Documentation/Changelog/9.0/Deprecation-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst b/typo3/sysext/core/Documentation/Changelog/9.0/Deprecation-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst
deleted file mode 100644 (file)
index a51790b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-.. include:: ../../Includes.txt
-
-==============================================================================
-Deprecation: #82506 - Remove BackendUserRepository injection in NoteController
-==============================================================================
-
-See :issue:`82506`
-
-Description
-===========
-
-To improve the performance of showing sys_note records the injection of the :php:`BackendUserRepository` has been
-removed in :php:`\TYPO3\CMS\SysNote\Controller\NoteController`.
-
-
-Impact
-======
-
-The method :php:`\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository::findByPidsAndAuthor` has been marked as deprecated.
-
-
-Affected Installations
-======================
-
-Any installation using third-party extension that use the method
-:php:`\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository::findByPidsAndAuthor`.
-
-
-Migration
-=========
-
-Use the method :php:`\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository::findByPidsAndAuthorId`. and use the
- user id as 2nd argument instead of a `BackendUser` object.
-
-.. index:: Backend, PHP-API, FullyScanned, ext:sys_note
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-84055-MigrateSys_notesAwayFromExtbase.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-84055-MigrateSys_notesAwayFromExtbase.rst
new file mode 100644 (file)
index 0000000..9114276
--- /dev/null
@@ -0,0 +1,37 @@
+.. include:: ../../Includes.txt
+
+======================================================
+Breaking: #84055 - Migrate sys_notes away from extbase
+======================================================
+
+See :issue:`84055`
+
+Description
+===========
+
+To simplify the rendering of sys_note records and improve the performance, the usage of `extbase` has
+been removed from the extension `sys_note`.
+
+
+Impact
+======
+
+The model :php:`TYPO3\CMS\SysNote\Domain\Model\SysNote` has been removed,
+the repository :php:`TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository` now
+returns a plain result instead of objects.
+
+It is not possible anymore more to change the template path of the extension.
+
+
+Affected Installations
+======================
+
+Any installation which relies on the repository and model or changed the template by using TypoScript.
+
+
+Migration
+=========
+
+To change the rendering of notes, override the hook and return a modified output.
+
+.. index:: Backend, PartiallyScanned, ext:sys_note
\ No newline at end of file
index bc8b640..aa61243 100644 (file)
@@ -512,6 +512,11 @@ return [
             'Breaking-82426-ExtJSAndExtDirectRemoval.rst',
         ],
     ],
+    'TYPO3\CMS\SysNote\Domain\Model\SysNote' => [
+        'restFiles' => [
+            'Breaking-84055-MigrateSys_notesAwayFromExtbase.rst',
+        ],
+    ],
 
     // Removed interfaces
     'TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface' => [
index b0af35b..2c820fb 100644 (file)
@@ -1230,7 +1230,7 @@ return [
         'numberOfMandatoryArguments' => 2,
         'maximumNumberOfArguments' => 2,
         'restFiles' => [
-            'Deprecation-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst',
+            'Breaking-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst',
         ],
     ],
     'TYPO3\CMS\Core\Service\AbstractService->devLog' => [
index 8991b25..e038ef0 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\SysNote\Controller;
 
 /*
@@ -14,22 +15,25 @@ namespace TYPO3\CMS\SysNote\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+use TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository;
+
 /**
- * Note controller
+ * Renders notes for the current backend user
+ *
+ * @internal
  */
-class NoteController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
+class NoteController
 {
     /**
-     * @var \TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository
+     * @var SysNoteRepository
      */
-    protected $sysNoteRepository;
+    protected $notesRepository;
 
-    /**
-     * @param \TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository $sysNoteRepository
-     */
-    public function injectSysNoteRepository(\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository $sysNoteRepository)
+    public function __construct()
     {
-        $this->sysNoteRepository = $sysNoteRepository;
+        $this->notesRepository = GeneralUtility::makeInstance(SysNoteRepository::class);
     }
 
     /**
@@ -38,12 +42,23 @@ class NoteController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
      * @param string $pids Single PID or comma separated list of PIDs
      * @return string
      */
-    public function listAction($pids)
+    public function listAction($pids): string
     {
         if (empty($pids) || empty($GLOBALS['BE_USER']->user['uid'])) {
             return '';
         }
-        $notes = $this->sysNoteRepository->findByPidsAndAuthorId($pids, $GLOBALS['BE_USER']->user['uid']);
-        $this->view->assign('notes', $notes);
+
+        $notes = $this->notesRepository->findByPidsAndAuthorId($pids, (int)$GLOBALS['BE_USER']->user['uid']);
+        if ($notes) {
+            $view = GeneralUtility::makeInstance(StandaloneView::class);
+            $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
+                'EXT:sys_note/Resources/Private/Templates/Note/List.html'
+            ));
+            $view->getRequest()->setControllerExtensionName('SysNote');
+            $view->assign('notes', $notes);
+            return $view->render();
+        }
+
+        return '';
     }
 }
diff --git a/typo3/sysext/sys_note/Classes/Core/Bootstrap.php b/typo3/sysext/sys_note/Classes/Core/Bootstrap.php
deleted file mode 100644 (file)
index 98f0e65..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-namespace TYPO3\CMS\SysNote\Core;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\Database\Connection;
-use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Bootstrap for note module
- */
-class Bootstrap
-{
-    /**
-     * Do not touch if you are not sure what you are doing!
-     * @var array
-     */
-    protected $extbaseConfiguration = [
-        'vendorName' => 'TYPO3\\CMS',
-        'extensionName' => 'SysNote',
-        'pluginName' => 'Note',
-    ];
-
-    /**
-     * @var array
-     */
-    protected $currentGetArguments;
-
-    /**
-     * Bootstrap extbase and execute controller
-     *
-     * @param string $controllerName Controller to execute
-     * @param string $actionName Action to run
-     * @param array $arguments Arguments to pass to the controller action
-     * @return string
-     */
-    public function run($controllerName, $actionName, array $arguments = [])
-    {
-        if (!$this->expectOutput($arguments)) {
-            return '';
-        }
-        $arguments['controller'] = ucfirst(trim($controllerName));
-        $arguments['action'] = lcfirst(trim($actionName));
-        $this->overrideGetArguments($arguments);
-        /** @var $extbaseBootstrap \TYPO3\CMS\Extbase\Core\Bootstrap */
-        $extbaseBootstrap = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
-        $content = $extbaseBootstrap->run('', $this->extbaseConfiguration);
-        $this->revertGetArguments();
-        return $content;
-    }
-
-    /**
-     * Check if the note plugin expects output. If there are no sys_note records on the given
-     * pages, the extbase bootstrap doesn't have to run the complete plugin.
-     * This mechanism should increase the performance of the hooked backend modules heavily.
-     *
-     * @param array $arguments Arguments for the extbase plugin
-     * @return bool
-     */
-    protected function expectOutput(array $arguments = [])
-    {
-        // no pids set
-        if (!isset($arguments['pids']) || empty($arguments['pids']) || empty($GLOBALS['BE_USER']->user['uid'])) {
-            return false;
-        }
-        $cleanedPageIds = GeneralUtility::intExplode(',', $arguments['pids'], true);
-        if (empty($cleanedPageIds)) {
-            return false;
-        }
-        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_note');
-        $count = $queryBuilder
-            ->count('uid')
-            ->from('sys_note')
-            ->where(
-                $queryBuilder->expr()->in(
-                    'pid',
-                    $queryBuilder->createNamedParameter($cleanedPageIds, Connection::PARAM_INT_ARRAY)
-                )
-            )
-            ->execute()
-            ->fetchColumn();
-        return (bool)$count;
-    }
-
-    /**
-     * Modify $_GET to force specific controller, action and arguments in
-     * extbase bootstrap process
-     *
-     * Note: Overwriting $_GET was the most simple solution here until extbase
-     * provides a clean way to force a controller and action in backend mode.
-     *
-     * @param array $arguments The arguments to set
-     */
-    protected function overrideGetArguments(array $arguments)
-    {
-        $this->currentGetArguments = $_GET;
-        $_GET['tx_sysnote_note'] = $arguments;
-    }
-
-    /**
-     * Revert previously backuped get arguments
-     */
-    protected function revertGetArguments()
-    {
-        if (is_array($this->currentGetArguments)) {
-            $_GET = $this->currentGetArguments;
-        }
-    }
-}
diff --git a/typo3/sysext/sys_note/Classes/Domain/Model/SysNote.php b/typo3/sysext/sys_note/Classes/Domain/Model/SysNote.php
deleted file mode 100644 (file)
index cf404ce..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-namespace TYPO3\CMS\SysNote\Domain\Model;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * SysNote model
- */
-class SysNote extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
-{
-    /**
-     * @var \DateTime
-     */
-    protected $creationDate;
-
-    /**
-     * @var \DateTime
-     */
-    protected $modificationDate;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Domain\Model\BackendUser
-     */
-    protected $author;
-
-    /**
-     * @var string
-     */
-    protected $subject;
-
-    /**
-     * @var string
-     */
-    protected $message;
-
-    /**
-     * @var bool
-     */
-    protected $personal;
-
-    /**
-     * @var int
-     */
-    protected $category;
-
-    /**
-     * @return \DateTime $creationDate
-     */
-    public function getCreationDate()
-    {
-        return $this->creationDate;
-    }
-
-    /**
-     * @param \DateTime $creationDate
-     */
-    public function setCreationDate($creationDate)
-    {
-        $this->creationDate = $creationDate;
-    }
-
-    /**
-     * @return \DateTime $modificationDate
-     */
-    public function getModificationDate()
-    {
-        return $this->modificationDate;
-    }
-
-    /**
-     * @param \DateTime $modificationDate
-     */
-    public function setModificationDate($modificationDate)
-    {
-        $this->modificationDate = $modificationDate;
-    }
-
-    /**
-     * @return \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author
-     */
-    public function getAuthor()
-    {
-        return $this->author;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author
-     */
-    public function setAuthor(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $author)
-    {
-        $this->author = $author;
-    }
-
-    /**
-     * @return string $subject
-     */
-    public function getSubject()
-    {
-        return $this->subject;
-    }
-
-    /**
-     * @param string $subject
-     */
-    public function setSubject($subject)
-    {
-        $this->subject = $subject;
-    }
-
-    /**
-     * @return string $message
-     */
-    public function getMessage()
-    {
-        return $this->message;
-    }
-
-    /**
-     * @param string $message
-     */
-    public function setMessage($message)
-    {
-        $this->message = $message;
-    }
-
-    /**
-     * @return bool $personal
-     */
-    public function getPersonal()
-    {
-        return $this->personal;
-    }
-
-    /**
-     * @param bool $personal
-     */
-    public function setPersonal($personal)
-    {
-        $this->personal = $personal;
-    }
-
-    /**
-     * @return int $category
-     */
-    public function getCategory()
-    {
-        return $this->category;
-    }
-
-    /**
-     * @param int $category
-     */
-    public function setCategory($category)
-    {
-        $this->category = $category;
-    }
-}
index ac6c4f8..58a6d20 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\SysNote\Domain\Repository;
 
 /*
@@ -14,76 +15,51 @@ namespace TYPO3\CMS\SysNote\Domain\Repository;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Database\Connection;
+use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Sys_note repository
+ *
+ * @internal
  */
-class SysNoteRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
+class SysNoteRepository
 {
-    /**
-     * Initialize the repository
-     */
-    public function initializeObject()
-    {
-        $querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
-        $querySettings->setRespectStoragePage(false);
-        $this->setDefaultQuerySettings($querySettings);
-    }
-
-    /**
-     * Find notes by given pids and author
-     *
-     * @param string $pids Single PID or comma separated list of PIDs
-     * @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author The author
-     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
-     * @deprecated
-     */
-    public function findByPidsAndAuthor($pids, \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author)
-    {
-        trigger_error('Method findByPidsAndAuthor() is deprecated since v9 and will be removed with v10', E_USER_DEPRECATED);
-        $pids = GeneralUtility::intExplode(',', (string)$pids);
-        $query = $this->createQuery();
-        $query->setOrderings([
-            'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
-            'creationDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
-        ]);
-        $query->matching(
-            $query->logicalAnd(
-                $query->in('pid', $pids),
-                $query->logicalOr(
-                    $query->equals('personal', 0),
-                    $query->equals('author', $author)
-                )
-            )
-        );
-        return $query->execute();
-    }
 
     /**
      * Find notes by given pids and author
      *
      * @param string $pids Single PID or comma separated list of PIDs
      * @param int $author author uid
-     * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
+     * @return array
      */
-    public function findByPidsAndAuthorId($pids, int $author)
+    public function findByPidsAndAuthorId($pids, int $author): array
     {
         $pids = GeneralUtility::intExplode(',', (string)$pids);
-        $query = $this->createQuery();
-        $query->setOrderings([
-            'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
-            'creationDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
-        ]);
-        $query->matching(
-            $query->logicalAnd(
-                $query->in('pid', $pids),
-                $query->logicalOr(
-                    $query->equals('personal', 0),
-                    $query->equals('author', $author)
+
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
+            ->getQueryBuilderForTable('sys_note');
+        $rows = $queryBuilder
+            ->select('sys_note.*', 'be_users.username', 'be_users.realName')
+            ->from('sys_note')
+            ->leftJoin(
+                'sys_note',
+                'be_users',
+                'be_users',
+                $queryBuilder->expr()->eq('sys_note.cruser', $queryBuilder->quoteIdentifier('be_users.uid'))
+            )
+            ->where(
+                $queryBuilder->expr()->in('sys_note.pid', $queryBuilder->createNamedParameter($pids, Connection::PARAM_INT_ARRAY)),
+                $queryBuilder->expr()->orX(
+                    $queryBuilder->expr()->in('sys_note.personal', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
+                    $queryBuilder->expr()->in('sys_note.cruser', $queryBuilder->createNamedParameter($author, \PDO::PARAM_INT))
                 )
             )
-        );
-        return $query->execute();
+            ->orderBy('sorting', 'asc')
+            ->addOrderBy('crdate', 'desc')
+            ->execute()->fetchAll();
+
+        return $rows;
     }
 }
index 9e242c8..43a29c6 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\SysNote\Hook;
 
 /*
@@ -14,6 +15,9 @@ namespace TYPO3\CMS\SysNote\Hook;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\SysNote\Controller\NoteController;
+
 /**
  * Hook for the info module
  */
@@ -28,8 +32,7 @@ class InfoModuleHook
      */
     public function render(array $params = [], \TYPO3\CMS\Info\Controller\PageInformationController $parentObject)
     {
-        /** @var $noteBootstrap \TYPO3\CMS\SysNote\Core\Bootstrap */
-        $noteBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\SysNote\Core\Bootstrap::class);
-        return $noteBootstrap->run('Note', 'list', ['pids' => $parentObject->pObj->id]);
+        $controller = GeneralUtility::makeInstance(NoteController::class);
+        return $controller->listAction($parentObject->pObj->id);
     }
 }
index dd9fef8..f3f4430 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\SysNote\Hook;
 
 /*
@@ -14,6 +15,9 @@ namespace TYPO3\CMS\SysNote\Hook;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\SysNote\Controller\NoteController;
+
 /**
  * Hook for the page module
  */
@@ -28,8 +32,7 @@ class PageHook
      */
     public function render(array $params = [], \TYPO3\CMS\Backend\Controller\PageLayoutController $parentObject)
     {
-        /** @var $noteBootstrap \TYPO3\CMS\SysNote\Core\Bootstrap */
-        $noteBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\SysNote\Core\Bootstrap::class);
-        return $noteBootstrap->run('Note', 'list', ['pids' => $parentObject->id]);
+        $controller = GeneralUtility::makeInstance(NoteController::class);
+        return $controller->listAction($parentObject->id);
     }
 }
index a7a33af..4f78348 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\SysNote\Hook;
 
 /*
@@ -14,6 +15,9 @@ namespace TYPO3\CMS\SysNote\Hook;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\SysNote\Controller\NoteController;
+
 /**
  * Hook for the list module
  */
@@ -28,8 +32,7 @@ class RecordListHook
      */
     public function render(array $params = [], \TYPO3\CMS\Recordlist\RecordList $parentObject)
     {
-        /** @var $noteBootstrap \TYPO3\CMS\SysNote\Core\Bootstrap */
-        $noteBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\SysNote\Core\Bootstrap::class);
-        return $noteBootstrap->run('Note', 'list', ['pids' => $parentObject->id]);
+        $controller = GeneralUtility::makeInstance(NoteController::class);
+        return $controller->listAction($parentObject->id);
     }
 }
diff --git a/typo3/sysext/sys_note/Configuration/TypoScript/constants.txt b/typo3/sysext/sys_note/Configuration/TypoScript/constants.txt
deleted file mode 100644 (file)
index a47c78c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# ======================================================================
-# Module constants
-# ======================================================================
-module.tx_sysnote {
-       view {
-               # cat=Internal Notes/general/1000; type=string; label=Layout Root Path: Path to layouts
-               layoutRootPath = EXT:sys_note/Resources/Private/Layouts/
-
-               # cat=Internal Notes/general/1010; type=string; label=Partial Root Path: Path to partials
-               partialRootPath = EXT:sys_note/Resources/Private/Partials/
-
-               # cat=Internal Notes/general/1020; type=string; label=Template Root Path: Path to templates
-               templateRootPath = EXT:sys_note/Resources/Private/Templates/
-       }
-}
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Configuration/TypoScript/setup.txt b/typo3/sysext/sys_note/Configuration/TypoScript/setup.txt
deleted file mode 100644 (file)
index 33ec34e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# ======================================================================
-# Module setup
-# ======================================================================
-module.tx_sysnote {
-       view {
-               layoutRootPath = {$module.tx_sysnote.view.layoutRootPath}
-               templateRootPath = {$module.tx_sysnote.view.templateRootPath}
-               partialRootPath = {$module.tx_sysnote.view.partialRootPath}
-       }
-}
-
-
-# ======================================================================
-# Extbase mapping
-# ======================================================================
-config.tx_extbase.persistence.classes {
-
-       TYPO3\CMS\SysNote\Domain\Model\SysNote.mapping {
-               tableName = sys_note
-               recordType =
-               columns {
-                       crdate.mapOnProperty = creationDate
-                       tstamp.mapOnProperty = modificationDate
-                       cruser.mapOnProperty = author
-               }
-       }
-
-}
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/Resources/Private/Layouts/Default.html b/typo3/sysext/sys_note/Resources/Private/Layouts/Default.html
deleted file mode 100644 (file)
index 036bdf0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<f:render section="Content" />
\ No newline at end of file
index 937eee1..19b6bdb 100644 (file)
@@ -1,52 +1,47 @@
 {namespace notes=TYPO3\CMS\SysNote\ViewHelpers}
 
-<f:layout name="Default" />
+<f:if condition="{notes}">
+       <h2><f:translate key="internal_note" /></h2>
 
-<f:section name="Content">
-       <f:if condition="{notes}">
-               <h2><f:translate key="internal_note" /></h2>
-
-               <div class="typo3-dblist-sysnotes">
-                       <f:for each="{notes}" as="note">
-                               <div class="panel panel-default panel-sysnote panel-sysnote-category-{note.category}">
-                                       <div class="panel-heading clearfix">
-                                               <span class="typeicon t3js-contextmenutrigger" data-table="sys_note" data-uid="{note.uid}">
-                                                       <core:icon identifier="sysnote-type-{note.category}" />
-                                               </span>
-                                               <span class="author">
-                                                       <f:translate key="author" />
-                                                       <f:if condition="{note.author.realName}">
-                                                               <f:then>{note.author.realName}</f:then>
-                                                               <f:else>{note.author.userName}</f:else>
-                                                       </f:if>
-                                               </span>
-                                               &nbsp; <span>&bull;</span> &nbsp;
-                                               <span class="date">
-                                                       <f:translate key="date" />
-                                                       <f:format.date>{note.modificationDate}</f:format.date>
-                                               </span>
-                                               <f:if condition="{note.personal}">
-                                                       &middot;
-                                                       <span class="personal">
-                                                               <f:translate key="personal" />&nbsp;<f:translate key="yes" /></span>
+       <div class="typo3-dblist-sysnotes">
+               <f:for each="{notes}" as="note">
+                       <div class="panel panel-default panel-sysnote panel-sysnote-category-{note.category}">
+                               <div class="panel-heading clearfix">
+                                       <span class="typeicon t3js-contextmenutrigger" data-table="sys_note" data-uid="{note.uid}">
+                                               <core:icon identifier="sysnote-type-{note.category}" />
+                                       </span>
+                                       <span class="author">
+                                               <f:translate key="author" />
+                                               <f:if condition="{note.realName}">
+                                                       <f:then>{note.realName}</f:then>
+                                                       <f:else>{note.userName}</f:else>
                                                </f:if>
+                                       </span>
+                                       &nbsp; <span>&bull;</span> &nbsp;
+                                       <span class="date">
+                                               <f:translate key="date" />
+                                               <f:format.date>{note.modificationDate}</f:format.date>
+                                       </span>
+                                       <f:if condition="{note.personal}">
+                                               &middot;
+                                               <span class="personal">
+                                                       <f:translate key="personal" />&nbsp;<f:translate key="yes" /></span>
+                                       </f:if>
 
-                                               <div class="btn-group pull-right">
-                                                       <a href="{notes:editLink(id:note.uid)}" class="btn btn-default btn-sm">
-                                                               <core:icon identifier="actions-open" />
-                                                       </a>
-                                                       <a href="{notes:deleteLink(id:note.uid)}" class="btn btn-default btn-sm t3js-modal-trigger" data-severity="warning" data-title="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:delete')}" data-content="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:deleteWarning')}" data-button-close-text="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')}">
-                                                               <core:icon identifier="actions-edit-delete" />
-                                                       </a>
-                                               </div>
-                                       </div>
-                                       <div class="panel-body">
-                                               <h4><span><f:if condition="{note.category}"><f:translate key="category.{note.category}" />: </f:if></span>{note.subject}</h4>
-                                               <f:format.nl2br>{note.message}</f:format.nl2br>
+                                       <div class="btn-group pull-right">
+                                               <a href="{notes:editLink(id:note.uid)}" class="btn btn-default btn-sm">
+                                                       <core:icon identifier="actions-open" />
+                                               </a>
+                                               <a href="{notes:deleteLink(id:note.uid)}" class="btn btn-default btn-sm t3js-modal-trigger" data-severity="warning" data-title="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:delete')}" data-content="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:deleteWarning')}" data-button-close-text="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')}">
+                                                       <core:icon identifier="actions-edit-delete" />
+                                               </a>
                                        </div>
                                </div>
-                       </f:for>
-               </div>
-
-       </f:if>
-</f:section>
+                               <div class="panel-body">
+                                       <h4><span><f:if condition="{note.category}"><f:translate key="category.{note.category}" />: </f:if></span>{note.subject}</h4>
+                                       <f:format.nl2br>{note.message}</f:format.nl2br>
+                               </div>
+                       </div>
+               </f:for>
+       </div>
+</f:if>
index 2aae3fc..b0de093 100644 (file)
@@ -1,13 +1,6 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-// Register "switchableControllerActions" manually because there is no plugin or module for sys_note available
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['SysNote']['modules']['Note']['controllers'] = [
-    'Note' => [
-        'actions' => ['list']
-    ]
-];
-
 // Hook into the list module
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']['sys_note'] = \TYPO3\CMS\SysNote\Hook\RecordListHook::class . '->render';
 // Hook into the page module
diff --git a/typo3/sysext/sys_note/ext_typoscript_constants.txt b/typo3/sysext/sys_note/ext_typoscript_constants.txt
deleted file mode 100644 (file)
index 8c04e05..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sys_note/Configuration/TypoScript/constants.txt">
\ No newline at end of file
diff --git a/typo3/sysext/sys_note/ext_typoscript_setup.txt b/typo3/sysext/sys_note/ext_typoscript_setup.txt
deleted file mode 100644 (file)
index d7d7929..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sys_note/Configuration/TypoScript/setup.txt">
\ No newline at end of file