Fix ForeignAPIRepo::fileExistsBatch()
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 26 Dec 2012 16:55:49 +0000 (11:55 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 9 Oct 2013 17:23:17 +0000 (13:23 -0400)
commitfab5872aeee612539c3ca5552eb45a04f82a041a
treea161c313fa14e1661ca0bff5041fabac88f42708
parent51833b036fad49e68d12e1f89b56fd098439f870
Fix ForeignAPIRepo::fileExistsBatch()

ForeignAPIRepo::fileExistsBatch() is extremely broken:
* If passed an array with numeric keys (e.g. as called from
  FileRepo::fileExists()), it will cache the fact that the item at index
  0 from the first call was found or not found, no matter what the
  actual file being queried is!
* But it doesn't even use its cache correctly. Rather than checking the
  value cached, it just assumes anything that was cached exists.
* It checks whether the page in the remote repository has a description
  page, not whether a file actually exists for the title.
* But it doesn't do that right either, so in the vast majority of cases
  it will decide everything exists.

All of this is offset by the fact that I can't find any code path that
would actually call this function.

Change-Id: I421e8892b642f5267b8dd755183ebd711db83152
includes/filerepo/ForeignAPIRepo.php