Page MenuHomePhabricator

Special:Export ignores parameters limit, dir and offset
Closed, ResolvedPublic

Description

Author: tani.kaoru

Description:
Contrary to the descriptions of the parameters on http://www.mediawiki.org/wiki/Parameters_to_Special:Export, Special:Export does not accept parameters limit, dir and offset.
When I try to get xml of limited number of revisions of specific wikipedia page, Special:Export always sends back all the revisions in ascending order. This cause malfunctions of receiving script due to the size of the xml.
As far as I know, this trouble appeared 25 or 26 March 2009. I was running some scripts to obtain past revisions of wikipedia pages and until then they had no problem.

Sample request (POST):
http://en.wikipedia.org/w/index.php?title=Special:Export&pages=XXXXX&dir=desc&limit=5&action=submit&history=1


Version: 1.15.x
Severity: normal
URL: http://en.wikipedia.org/w/index.php?title=Special:Export

Details

Reference
bz18180

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:32 PM
bzimport set Reference to bz18180.
bzimport added a subscriber: Unknown Object (MLST).

tani.kaoru wrote:

This might be misunderstanding. The description says "if the history parameter is true, then all versions of each page are returned."

azliq7 wrote:

I believe this bug still remains unfixed, as I am unable to obtain specific revisions of a page. Looking through the source code, the parameters "limit", "dir", and "offset" are still being used. However, using these parameters (in POST requests) seem to have no effect in Special:Export, even if the "history" parameter is true or false.

I believe that the bug is located between lines 79 and 110 of the code, but I may be wrong.

(In reply to comment #2)

even if the "history"
parameter is true or false.

Instead of setting &history=false , try setting &history=0 or not setting &history at all.

azliq7 wrote:

(In reply to comment #3)

(In reply to comment #2)

even if the "history"
parameter is true or false.

Instead of setting &history=false , try setting &history=0 or not setting
&history at all.

With true or false, I meant history=1 or history=0.
Ignoring the parameter didn't work for me.

This is the summary of my results:

curonly history result

  • - full history 1 - current rev 0 - current rev
  • 1 full history
  • 0 full history 0 0 current rev 1 0 current rev 0 1 current rev 1 1 current rev

azliq7 wrote:

In the tests I conducted, I tried using all three parameters (limit, offset, dir), and a combination of these. Using the parameters had no effect, and Special:Export simply produced the results mentioned in "Comment #4".

According to "tani.kaoru@gmail.com", this bug occurred in Wikipedia sometime in March 2009. In our wiki run by Wikia, we recently upgraded from version 1.15 to 1.15.1, and Special:Export started ignoring the parameters. I think it is safe to assume that this bug is related to the 1.15.1 upgrade.

azliq7 wrote:

Changing the version to 1.15.1.

azliq7 wrote:

If I knew how to produce a patch, I would have. But I simply don't know how to go about it.


File: /includes/export.php


This involves moving the if statement of "# Full history dumps..." (Line 210) below the if statement of "Time offset/limit for all pages/history..." (Line 229)

The time offset/limit parameters were being ignored because the if statement for "Full history dumps" was being triggered first.
Moving the if statement for "Time offset/limit for all pages/history" parameters above the full history seemed to have solved the bug.

I tested this in my wiki, and after this patch, the parameters are now being recognised. I was able to export specific revisions of a page.

azliq7 wrote:

Export.php -> recognise limit, dir and offset parameters

This version of "Export.php" should recognise the limit, dir, and offset parameters.

attachment Export-new.php ignored as obsolete

azliq7 wrote:

Diff patch

Patch to recognise offset/limit/dir parameters

Attached:

  • Bug 15667 has been marked as a duplicate of this bug. ***