[BUGFIX] Remove baseUri from the Storage 71/28271/4
authorFabien Udriot <fabien.udriot@ecodev.ch>
Tue, 11 Mar 2014 19:17:17 +0000 (20:17 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 12 Mar 2014 10:35:02 +0000 (11:35 +0100)
The baseUri in the Storage has a Getter and is the
only thing initialized in the "processConfiguration"
method of a Storage. Due to the fact that "baseUri"
is not a field in the storage-table this never could
be set, and therefore always has been null.

It appears that this has been a left over from earlier
days and it is save to remove this, since the getter
always returned NULL (and as a result was unusable).
In addition the processConfiguration and its signals
are removed as they have and never had an effect anyhow.

Change-Id: I3416ee393a1eb3d0f1ea5fc588a351bb1555cdba
Releases: 6.2
Resolves: #56783
Reviewed-on: https://review.typo3.org/28271
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php

index 5500d8e..c2b889c 100644 (file)
@@ -68,8 +68,6 @@ use TYPO3\CMS\Core\Utility\PathUtility;
  */
 class ResourceStorage {
 
-       const SIGNAL_PreProcessConfiguration = 'preProcessConfiguration';
-       const SIGNAL_PostProcessConfiguration = 'postProcessConfiguration';
        const SIGNAL_PreFileAdd = 'preFileAdd';
        const SIGNAL_PostFileAdd = 'postFileAdd';
        const SIGNAL_PreFileCopy = 'preFileCopy';
@@ -116,13 +114,6 @@ class ResourceStorage {
        protected $configuration;
 
        /**
-        * The base URI to this storage.
-        *
-        * @var string
-        */
-       protected $baseUri;
-
-       /**
         * @var Service\FileProcessingService
         */
        protected $fileProcessingService;
@@ -235,7 +226,6 @@ class ResourceStorage {
 
                $this->isDefault = (isset($storageRecord['is_default']) && $storageRecord['is_default'] == 1);
                $this->resetFileAndFolderNameFiltersToDefault();
-               $this->processConfiguration();
        }
 
        /**
@@ -266,30 +256,6 @@ class ResourceStorage {
        }
 
        /**
-        * Processes the configuration of this storage.
-        *
-        * @throws \InvalidArgumentException If a required configuration option is not set or has an invalid value.
-        * @return void
-        */
-       protected function processConfiguration() {
-               $this->emitPreProcessConfigurationSignal();
-               if (isset($this->configuration['baseUri'])) {
-                       $this->baseUri = rtrim($this->configuration['baseUri'], '/') . '/';
-               }
-               $this->emitPostProcessConfigurationSignal();
-       }
-
-       /**
-        * Returns the base URI of this storage; all files are reachable via URLs
-        * beginning with this string.
-        *
-        * @return string
-        */
-       public function getBaseUri() {
-               return $this->baseUri;
-       }
-
-       /**
         * Sets the storage that belongs to this storage.
         *
         * @param Driver\DriverInterface $driver
@@ -2115,24 +2081,6 @@ class ResourceStorage {
        }
 
        /**
-        * Emits the configuration pre-processing signal
-        *
-        * @return void
-        */
-       protected function emitPreProcessConfigurationSignal() {
-               $this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PreProcessConfiguration, array($this));
-       }
-
-       /**
-        * Emits the configuration post-processing signal
-        *
-        * @return void
-        */
-       protected function emitPostProcessConfigurationSignal() {
-               $this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PostProcessConfiguration, array($this));
-       }
-
-       /**
         * Emits file pre-add signal
         *
         * @param string $targetFileName
index 04da355..7ca1ccc 100644 (file)
@@ -117,7 +117,6 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
        protected function createDriverMock($driverConfiguration, \TYPO3\CMS\Core\Resource\ResourceStorage $storageObject = NULL, $mockedDriverMethods = array()) {
                $this->initializeVfs();
 
-
                if (!isset($driverConfiguration['basePath'])) {
                        $driverConfiguration['basePath'] = $this->getMountRootUrl();
                }
@@ -139,15 +138,6 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
        }
 
        /**
-        * @test
-        */
-       public function baseUriGetsSlashAppended() {
-               $uri = 'http://example.org/somewhere/else';
-               $this->prepareFixture(array('baseUri' => $uri));
-               $this->assertEquals($uri . '/', $this->fixture->getBaseUri());
-       }
-
-       /**
         * @return array
         */
        public function capabilitiesDataProvider() {
@@ -194,26 +184,25 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
         * @test
         * @dataProvider capabilitiesDataProvider
         */
-       public function capabilitiesOfStorageObjectAreCorrectlySet(array $capabilites) {
+       public function capabilitiesOfStorageObjectAreCorrectlySet(array $capabilities) {
                $storageRecord = array(
-                       'is_public' => $capabilites['public'],
-                       'is_writable' => $capabilites['writable'],
-                       'is_browsable' => $capabilites['browsable'],
+                       'is_public' => $capabilities['public'],
+                       'is_writable' => $capabilities['writable'],
+                       'is_browsable' => $capabilities['browsable'],
                        'is_online' => TRUE
                );
                $mockedDriver = $this->createDriverMock(
                        array(
                                'pathType' => 'relative',
                                'basePath' => 'fileadmin/',
-                               'baseUri' => 'http://www.test.de/'
                        ),
                        $this->fixture,
                        NULL
                );
                $this->prepareFixture(array(), FALSE, $mockedDriver, $storageRecord);
-               $this->assertEquals($capabilites['public'], $this->fixture->isPublic(), 'Capability "public" is not correctly set.');
-               $this->assertEquals($capabilites['writable'], $this->fixture->isWritable(), 'Capability "writable" is not correctly set.');
-               $this->assertEquals($capabilites['browsable'], $this->fixture->isBrowsable(), 'Capability "browsable" is not correctly set.');
+               $this->assertEquals($capabilities['public'], $this->fixture->isPublic(), 'Capability "public" is not correctly set.');
+               $this->assertEquals($capabilities['writable'], $this->fixture->isWritable(), 'Capability "writable" is not correctly set.');
+               $this->assertEquals($capabilities['browsable'], $this->fixture->isBrowsable(), 'Capability "browsable" is not correctly set.');
        }
 
        /**