[BUGFIX] EXT:documentation should accept other index file names 41/24441/4
authorJohannes Feustel <s@feustel.eu>
Sun, 6 Oct 2013 23:04:20 +0000 (01:04 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 12 Oct 2013 16:05:54 +0000 (18:05 +0200)
EXT:documentation checks for Index.html, index.html and index.htm as
main files for additional html documentations.

Change-Id: Idd2970ef9d6cc1b6f436b0c0fe0c607cf7b9d903
Resolves: #52569
Releases: 6.2
Reviewed-on: https://review.typo3.org/24441
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/documentation/Classes/Domain/Repository/DocumentRepository.php

index 057401f..0570642 100644 (file)
@@ -165,7 +165,14 @@ class DocumentRepository {
                                        $documentFile = '';
                                        switch ($format) {
                                                case 'html':
-                                                       $documentFile = 'Index.html';
+                                                       // Try to find a valid index file
+                                                       $indexFiles = array('Index.html', 'index.html', 'index.htm');
+                                                       foreach ($indexFiles as $indexFile) {
+                                                               if (file_exists(PATH_site . $formatPath . $format . '/' . $indexFile)) {
+                                                                       $documentFile = $indexFile;
+                                                                       break;
+                                                               }
+                                                       }
                                                        break;
                                                case 'pdf':
                                                        // Retrieve first PDF
@@ -175,7 +182,7 @@ class DocumentRepository {
                                                        }
                                                        break;
                                        }
-                                       if (!empty($documentFile) && is_file(PATH_site . $formatPath . $format . '/' . $documentFile)) {
+                                       if (!empty($documentFile)) {
                                                /** @var \TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $documentFormat */
                                                $documentFormat = $this->objectManager->get('TYPO3\\CMS\\Documentation\\Domain\\Model\\DocumentFormat')
                                                        ->setFormat($format)