On Tue, Feb 10, 2009 at 11:24:51PM +0100, Roan Kattouw wrote:
Brad Jorsch schreef:
On Tue, Feb 10, 2009 at 10:14:38PM +0100, Roan Kattouw wrote:
Implemented something similar to your suggestion in r47108.
Note there's no need for asort in this one, asort is only needed when you want to keep the array keys.
Oops, meant ksort(). You can't really sort Title objects :P , but the keys are page IDs.
$titles isn't title objects there, though. It's the keys off of $pageIds[NS_FILE], which seems to be page title strings.
I don't see how that's a problem. The <page> element for the missing image is always gonna be there (hell, it's even there for images that are already done and skipped thanks to iicontinue), it just has an extra missing="" filerepo="" thingy on it. Don't see much of a problem there.
Good point.
prop=info could be done by merging $titles and $missing (if necessary), doing an asort, and using similar logic. The continue would be just the title.
I'll look into that tomorrow as well.
On second thought, I don't think we need it: prop=info doesn't have the issues other modules have, because it doesn't return multiple entries per page. Just throwing in an asort() (which I'll do tomorrow) should suffice.
If you're removing the continuation (as you did for missing images above) then you don't even need to asort if you don't want to. If you're keeping continuation, though, then both existing and missing pages could trigger a continuation so you really would need the merge (otherwise consider what happens if titles=A|Bdoesnotexist|C|D|E|F, D triggers a continuation, and Bdoesnotexist also doesn't fit after).
Actually I wouldn't need to merge them: I'll just do all existing pages first, then all missing ones (this already happens), and sort those arrays separately. The offset continue thing will work just fine.
Will it really?
** First query: 1. You'll process 'A' for the output. 2. You'll process 'C' for the output. 3. You'll try to process 'D' for the output, but it will fail for being too big. You'll set incontinue=2. 4. You may or may not try to process 'Bdoesnotexist'. If so, it fails too. Do you set incontinue=0 now? Or leave it as 2? ** Someone creates Bdoesnotexist. ** Second query: (incontinue=2) 1. You'll skip 'A', because 0<2. 2. You'll skip the newly created 'Bdoesnotexist', because 1<2. (oops!) 3. You'll process 'C' for the output, again. (oops!) 4. You'll process 'D' for the output. 5. You'll process 'E' for the output. 6. You'll process 'F' for the output. ** Alternate second query: (incontinue=0) 1. You'll process 'A' for the output, because 0 is not < 0. (oops!) 2. You'll process 'C' for the output. (oops!) 3. You'll try to process 'D' for the output, but it will fail for being too big. You'll set incontinue=2. 4. You try to process 'Bdoesnotexist'. It fails too. You set incontinue=0 again. Lather, rinse, repeat. (oops!)
** First query: 1. You'll process 'A' for the output. 2. You'll process 'C' for the output. 3. You'll try to process 'D' for the output, but it will fail for being too big. You'll set incontinue=2. 4. You may or may not try to process 'Bdoesnotexist'. If so, it fails too. Do you set incontinue=0 now? Or leave it as 2? ** Someone deletes A. ** Second query: (incontinue=2) 1. You'll skip 'C', because 0<2. 2. You'll skip 'D', because 1<2. (oops!) 3. You'll process 'E' for the output. 4. You'll process 'F' for the output. 5. You'll process now-missing page 'A' for the output, again. (oops!) [Or not, because 0<2.] 6. You'll process 'Bdoesnotexist' for the output. [Or not, because 1<2. (oops!)] ** Alternate second query: (incontinue=0) 1. You'll process 'C' for the output, again, because 0 is not < 0. (oops!) 2. You'll process 'D' for the output. 3. You'll process 'E' for the output. 4. You'll process 'F' for the output. 5. You'll process now-missing page 'A' for the output, again. (oops!) 6. You'll process 'Bdoesnotexist' for the output.