Project

General

Profile

Actions

Bug #87652

closed

SoftReferenceIndex :: TypoLink :: links like "t3:// FileLinks" won't be recognized

Added by Ralph Brugger about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-02-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Our customer has complained about missing references in the file list.

After some debugging, we noticed the following:

We have some extensions which have some input fields as typolinks:

<config type="array">
    <type>input</type>
    <renderType>inputLink</renderType>
    <softref>typolink</softref>
    <size>100</size>
    <max>512</max>
    <eval>trim</eval>
    <fieldControl>
        <linkPopup>
            <options>
                <title>Link</title>
            </options>
        </linkPopup>
    </fieldControl>
</config>

The SoftReferenceIndexer does not recognize those links, so the filelist does show zeros references, and our client startet to delete those files.

The problem is located inside the function

TYPO3\CMS\Core\Database\SoftReferenceIndex::getTypoLinkParts

Old Code:

// Check for FAL link-handler keyword
if ($linkHandlerKeyword === 'file') {
    $finalTagParts['LINK_TYPE'] = 'file';
    $finalTagParts['identifier'] = trim($link_param);
    return $finalTagParts;
}

This will only work for old-syntaxed file links like "file:nnnn" but not for the new syntax "t3://file::".

I've added the followeing code snipped, fot the new syntax file links:

        if ($linkHandlerKeyword === 't3') {

            // linking to any t3:// syntax
            if (stripos($link_param, 't3://') === 0) {

                // lets parse the urn
                $linkParsed = parse_url($link_param);
                if (isset($linkParsed['host']) && isset($linkParsed['scheme']) && isset($linkParsed['query'])){
                    $identifier = $linkParsed['host'];
                    $scheme = $linkParsed['scheme'];
                    $query = $linkParsed['query'];
                    $finalTagParts['LINK_TYPE'] = $identifier;
                    if($query && $identifier === 'file' ){
                        $queryparts = explode('=', $query);
                        if($queryparts){
                            if(is_array($queryparts)){
                                $queryKey = $queryparts[0];
                                $queryValue = (integer) $queryparts[1];
                                if (is_int($queryValue)){
                                    $finalTagParts['identifier'] = "$identifier:$queryValue";
                                    unset($linkParsed);
                                    unset($queryparts);
                                    return $finalTagParts;
                                }
                            }
                        }
                    }
                }
            }
        }

When saving those records in the backend or when we trigger to rebuild the refindex, those links will now be recognized.


Files

SoftReferenceIndex.php (35.3 KB) SoftReferenceIndex.php Ralph Brugger, 2019-02-05 09:56

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #84016: impexp: page links are parsed / replaced incorrectely due to error in SoftReferenceIndexClosed2018-02-22

Actions
Related to TYPO3 Core - Bug #88207: SoftReferenceIndex is missing support for t3://file uriClosed2019-04-25

Actions
Actions

Also available in: Atom PDF