Page MenuHomePhabricator

Image links from #ifexist:Media:... are not being registered properly on tawiktionary
Open, Needs TriagePublic


From this list post:

If you do something like {{#ifexist:Media:Foo.ogg}}, this should register a link both in the local imagelinks table, and the commons globalimagelinks table. This is used for cache clearing. Currently the link only seems to be added if the file exists.


Expected behaviour: Both DoesNotExist.png and Example.png are registered as image links
Actual Behaviour: Only Example.png is registered.

I think the logic error is due to the early return:

$file = wfFindFile( $title );
if ( !$file ) { 
        return $else;
        $file->getName(), $file->getTimestamp(), $file->getSha1() );
return $file->exists() ? $then : $else;

This will exit before registering the dependency if the file does not exist as wfFindFile will return false.

Getting started steps

Event Timeline

Bawolff created this task.Feb 24 2020, 4:10 AM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptFeb 24 2020, 4:10 AM

Anyways, a suggested fix might be, in the !$file case, to add $parser->mOutput->addImage( $title->getDBKey() )

srishakatux updated the task description. (Show Details)Feb 25 2020, 3:32 AM