Page MenuHomePhabricator

Foreign (DB) file repositories misbehave on wikis with a shared actor table
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue:

  • Create 3 wikis, wiki_a, wiki_b and wiki_c
  • Set $wgSharedDB = 'wiki_a'; on all wikis
  • Set $wgSharedTables[] = 'actor'; on all wikis
  • Set up file sharing between wiki_b and wiki_c
  • Try using files from wiki_b on wiki_c

What happens?: The files appear as red links.

This is because FileSelectQueryBuilder queries the actor table on the shared repository database, as returned by ForeignDBRepo::getDBFactory(). But shared repository's database has an empty actor table, because the actor table actually resides in wiki_a's database.

I fixed this for myself by setting table aliases on the database returned from ::getDBFactory(). But this could be implemented in MediaWiki by allowing a configuration option for shared tables directly in $wgForeignFileRepos. Unless there is an existent configuration option that I'm missing?

What should have happened instead?: The files work.

Software version: 1.44.2 (bc12cea)

Related Objects

Event Timeline

Other way (without custom classes) to work around table aliases not being set on the secondary DB handles is using the ForeignDBViaLBRepo file repo class and at minimum assigning the default section in wgLBFactoryConf.