Page MenuHomePhabricator

Doesn't continue correctly (stops at 500)
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:
use grabFiles.php

Actual Results:
Stops after 500 files

Expected Results:
Downloads all files


I have already found the problem, and found a fix for it, I just don't know how to make pull requests on phabricator (or whatever they're called on here), I only use GitHub.

Anyways, it gets the gaicontinue from the query wrong, line 79 of grabFiles needs to be changed to

$gaifrom = $result['query-continue']['allimages']['gaicontinue'];

I have already tested this and it works perfectly.

Event Timeline

@daniel11420: Thanks for reporting this and taking a look at the code!

You are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review and provide feedback. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

You're right. The api changed somewhere after MediaWiki 1.19. In MediaWiki 1.19 the returned structure is gaifrom, but on current MediaWiki versions it's gaicontinue. However, it would need other changes, since the continue parameters are inside a continue object and not query-continue.

Documenting this just for when someone works on it:

For example, I have this return in MediaWiki 1.19

{
    "query-continue": {
        "allimages": {
            "gaifrom": "B2W2 Elecci\u00f3n de personajes.png"
        }
    },
    "query": {
        "pages": {
            "264639": {
                "pageid": 264639,
                "ns": 6,
                "title": "Archivo:B2W2 Campo de Batalla.png"
            },
            "264640": {
                "pageid": 264640,
                "ns": 6,
                "title": "Archivo:B2W2 Campo de Batallas (2).png"
            }
        }
    }
}

And this return in MediaWiki 1.34

{
    "batchcomplete": "",
    "continue": {
        "gaicontinue": "B2W2_Elecci\u00f3n_de_personajes.png",
        "continue": "gaicontinue||"
    },
    "query": {
        "pages": {
            "264639": {
                "pageid": 264639,
                "ns": 6,
                "title": "Archivo:B2W2 Campo de Batalla.png"
            },
            "264640": {
                "pageid": 264640,
                "ns": 6,
                "title": "Archivo:B2W2 Campo de Batallas (2).png"
            }
        }
    }
}