[BUGFIX] Allow symlinked directories in Install Tool 83/41383/3
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 15 Jul 2015 22:45:32 +0000 (00:45 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 16 Jul 2015 07:46:28 +0000 (09:46 +0200)
If a directory is expected but it is actual a link,
check the linked resource. If this is a directory, allow that
as well.

Change-Id: I85b98a683c987d36a67536050ee595848c7a3b8e
Resolves: #57706
Releases: master
Reviewed-on: http://review.typo3.org/41383
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php
typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php

index a1c1466..bff025c 100644 (file)
@@ -258,7 +258,7 @@ class DirectoryNode extends AbstractNode implements NodeInterface {
         */
        protected function isDirectory() {
                $path = $this->getAbsolutePath();
-               return (!@is_link($path) && @is_dir($path));
+               return (@is_dir($path) || (is_link($path) && @is_dir(@readlink($path))));
        }
 
        /**
index df8f598..a05726d 100644 (file)
@@ -600,7 +600,7 @@ class DirectoryNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
-       public function isDirectoryReturnsFalseIfNameIsALinkToADirectory() {
+       public function isDirectoryReturnsTrueIfNameIsALinkToADirectory() {
                if (TYPO3_OS === 'WIN') {
                        $this->markTestSkipped('Test not available on Windows OS.');
                }
@@ -614,7 +614,7 @@ class DirectoryNodeTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                mkdir($path . '/' . $dir);
                symlink($path . '/' . $dir, $path . '/' . $link);
                $node->expects($this->any())->method('getAbsolutePath')->will($this->returnValue($path . '/' . $link));
-               $this->assertFalse($node->_call('isDirectory'));
+               $this->assertTrue($node->_call('isDirectory'));
        }
 
 }