[BUGFIX] Prevent Inclusion of ResourceStorage from Bootstrap 16/28416/3
authorThomas Maroschik <tmaroschik@dfau.de>
Sat, 15 Mar 2014 11:43:38 +0000 (12:43 +0100)
committerPhilipp Gampe <philipp.gampe@typo3.org>
Mon, 17 Mar 2014 21:33:24 +0000 (22:33 +0100)
During bootstrapping the ResourceStorage and ResourceFactory
is loaded and evaluated just because of two constants containing
signal names used in ext_localconf. This introduces unnecessary
overhead especially in eID context.

The constants have been extracted to an interface that are way
faster parsed.

Resolves: #56335
Releases: 6.2
Change-Id: I509593d2720c595fa7e4f1c9b5c63fd09fea724c
Reviewed-on: https://review.typo3.org/28416
Reviewed-by: Wouter Wolters
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
typo3/sysext/core/Classes/Resource/ResourceFactory.php
typo3/sysext/core/Classes/Resource/ResourceFactoryInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Classes/Resource/ResourceStorageInterface.php [new file with mode: 0644]
typo3/sysext/core/ext_localconf.php

index 9a10e8b..d34646c 100644 (file)
@@ -38,9 +38,7 @@ use TYPO3\CMS\Core\Utility\PathUtility;
  *
  * @author Andreas Wolf <andreas.wolf@typo3.org>
  */
-class ResourceFactory implements \TYPO3\CMS\Core\SingletonInterface {
-
-       const SIGNAL_PostProcessStorage = 'postProcessStorage';
+class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\SingletonInterface {
 
        /**
         * Gets a singleton instance of this class.
diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactoryInterface.php b/typo3/sysext/core/Classes/Resource/ResourceFactoryInterface.php
new file mode 100644 (file)
index 0000000..c69f64e
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+namespace TYPO3\CMS\Core\Resource;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Thomas Maroschik <tmaroschik@dfau.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * An interface containing constants for the resource factory
+ */
+interface ResourceFactoryInterface {
+
+       const SIGNAL_PostProcessStorage = 'postProcessStorage';
+
+}
index b014d35..a232fcd 100644 (file)
@@ -66,31 +66,7 @@ use TYPO3\CMS\Core\Utility\PathUtility;
  * @author Andreas Wolf <andreas.wolf@typo3.org>
  * @author Ingmar Schlecht <ingmar@typo3.org>
  */
-class ResourceStorage {
-
-       const SIGNAL_PreFileAdd = 'preFileAdd';
-       const SIGNAL_PostFileAdd = 'postFileAdd';
-       const SIGNAL_PreFileCopy = 'preFileCopy';
-       const SIGNAL_PostFileCopy = 'postFileCopy';
-       const SIGNAL_PreFileMove = 'preFileMove';
-       const SIGNAL_PostFileMove = 'postFileMove';
-       const SIGNAL_PreFileDelete = 'preFileDelete';
-       const SIGNAL_PostFileDelete = 'postFileDelete';
-       const SIGNAL_PreFileRename = 'preFileRename';
-       const SIGNAL_PostFileRename = 'postFileRename';
-       const SIGNAL_PreFileReplace = 'preFileReplace';
-       const SIGNAL_PostFileReplace = 'postFileReplace';
-       const SIGNAL_PreFolderAdd = 'preFolderAdd';
-       const SIGNAL_PostFolderAdd = 'postFolderAdd';
-       const SIGNAL_PreFolderCopy = 'preFolderCopy';
-       const SIGNAL_PostFolderCopy = 'postFolderCopy';
-       const SIGNAL_PreFolderMove = 'preFolderMove';
-       const SIGNAL_PostFolderMove = 'postFolderMove';
-       const SIGNAL_PreFolderDelete = 'preFolderDelete';
-       const SIGNAL_PostFolderDelete = 'postFolderDelete';
-       const SIGNAL_PreFolderRename = 'preFolderRename';
-       const SIGNAL_PostFolderRename = 'postFolderRename';
-       const SIGNAL_PreGeneratePublicUrl = 'preGeneratePublicUrl';
+class ResourceStorage implements ResourceStorageInterface {
 
        /**
         * The storage driver instance belonging to this storage.
@@ -157,23 +133,6 @@ class ResourceStorage {
        protected $signalSlotDispatcher;
 
        /**
-        * Capability for being browsable by (backend) users
-        */
-       const CAPABILITY_BROWSABLE = 1;
-       /**
-        * Capability for publicly accessible storages (= accessible from the web)
-        */
-       const CAPABILITY_PUBLIC = 2;
-       /**
-        * Capability for writable storages. This only signifies writability in
-        * general - this might also be further limited by configuration.
-        */
-       const CAPABILITY_WRITABLE = 4;
-       /**
-        * Name of the default processing folder
-        */
-       const DEFAULT_ProcessingFolder = '_processed_';
-       /**
         * @var Folder
         */
        protected $processingFolder;
diff --git a/typo3/sysext/core/Classes/Resource/ResourceStorageInterface.php b/typo3/sysext/core/Classes/Resource/ResourceStorageInterface.php
new file mode 100644 (file)
index 0000000..ab43e76
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+namespace TYPO3\CMS\Core\Resource;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Thomas Maroschik <tmaroschik@dfau.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * The interface for a resource storage containing all constants
+ *
+ */
+interface ResourceStorageInterface {
+
+       const SIGNAL_PreFileAdd = 'preFileAdd';
+       const SIGNAL_PostFileAdd = 'postFileAdd';
+       const SIGNAL_PreFileCopy = 'preFileCopy';
+       const SIGNAL_PostFileCopy = 'postFileCopy';
+       const SIGNAL_PreFileMove = 'preFileMove';
+       const SIGNAL_PostFileMove = 'postFileMove';
+       const SIGNAL_PreFileDelete = 'preFileDelete';
+       const SIGNAL_PostFileDelete = 'postFileDelete';
+       const SIGNAL_PreFileRename = 'preFileRename';
+       const SIGNAL_PostFileRename = 'postFileRename';
+       const SIGNAL_PreFileReplace = 'preFileReplace';
+       const SIGNAL_PostFileReplace = 'postFileReplace';
+       const SIGNAL_PreFolderAdd = 'preFolderAdd';
+       const SIGNAL_PostFolderAdd = 'postFolderAdd';
+       const SIGNAL_PreFolderCopy = 'preFolderCopy';
+       const SIGNAL_PostFolderCopy = 'postFolderCopy';
+       const SIGNAL_PreFolderMove = 'preFolderMove';
+       const SIGNAL_PostFolderMove = 'postFolderMove';
+       const SIGNAL_PreFolderDelete = 'preFolderDelete';
+       const SIGNAL_PostFolderDelete = 'postFolderDelete';
+       const SIGNAL_PreFolderRename = 'preFolderRename';
+       const SIGNAL_PostFolderRename = 'postFolderRename';
+       const SIGNAL_PreGeneratePublicUrl = 'preGeneratePublicUrl';
+
+       /**
+        * Capability for being browsable by (backend) users
+        */
+       const CAPABILITY_BROWSABLE = 1;
+       /**
+        * Capability for publicly accessible storages (= accessible from the web)
+        */
+       const CAPABILITY_PUBLIC = 2;
+       /**
+        * Capability for writable storages. This only signifies writability in
+        * general - this might also be further limited by configuration.
+        */
+       const CAPABILITY_WRITABLE = 4;
+       /**
+        * Name of the default processing folder
+        */
+       const DEFAULT_ProcessingFolder = '_processed_';
+
+}
index e431afc..60243c5 100644 (file)
@@ -6,7 +6,7 @@ if (!defined('TYPO3_MODE')) {
 if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
        \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher')->connect(
                'TYPO3\\CMS\\Core\\Resource\\ResourceFactory',
-               \TYPO3\CMS\Core\Resource\ResourceFactory::SIGNAL_PostProcessStorage,
+               \TYPO3\CMS\Core\Resource\ResourceFactoryInterface::SIGNAL_PostProcessStorage,
                'TYPO3\\CMS\\Core\\Resource\\Security\\StoragePermissionsAspect',
                'addUserPermissionsToStorage'
        );
@@ -20,7 +20,7 @@ if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
 
 \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher')->connect(
        'TYPO3\\CMS\\Core\\Resource\\ResourceStorage',
-       \TYPO3\CMS\Core\Resource\ResourceStorage::SIGNAL_PostFileDelete,
+       \TYPO3\CMS\Core\Resource\ResourceStorageInterface::SIGNAL_PostFileDelete,
        'TYPO3\\CMS\\Core\\Resource\\Processing\\FileDeletionAspect',
        'removeFromRepository'
 );