Last modified: 2014-09-23 23:35:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T6837, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 4837 - Export specified revisions of a page
Export specified revisions of a page
Status: NEW
Product: MediaWiki
Classification: Unclassified
Export/Import (Other open bugs)
All All
: Low enhancement with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-reviewed
: 5599 15687 (view as bug list)
Depends on: 38669
Blocks: 15686
  Show dependency treegraph
Reported: 2006-02-02 13:47 UTC by Lupin
Modified: 2014-09-23 23:35 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

patch (2.57 KB, patch)
2006-02-02 13:47 UTC, Lupin
fix sql injection, hopefully (2.57 KB, patch)
2006-02-02 14:49 UTC, Lupin
patch supporting multiple old revisions (4.20 KB, patch)
2006-02-02 19:43 UTC, Lupin
attempting to address brion's concerns (2.26 KB, patch)
2006-02-02 20:27 UTC, Lupin
don't require $oldid in pagesByName (2.28 KB, patch)
2006-02-02 20:40 UTC, Lupin
another attempt (3.05 KB, patch)
2006-02-02 21:10 UTC, Lupin
much nicer patch (3.85 KB, patch)
2006-02-02 23:13 UTC, Lupin
more flexible patch (5.61 KB, patch)
2006-02-03 13:02 UTC, Lupin
"much nicer patch" reinstated (3.85 KB, patch)
2006-02-03 20:58 UTC, Lupin

Description Lupin 2006-02-02 13:47:20 UTC
This patch makes Special:Export act on oldid instructions in the url.
Comment 1 Lupin 2006-02-02 13:47:53 UTC
Created attachment 1341 [details]
Comment 2 Lupin 2006-02-02 14:49:15 UTC
Created attachment 1343 [details]
fix sql injection, hopefully
Comment 3 Brion Vibber 2006-02-02 17:39:07 UTC
The interface looks broken; a single revision ID to go along with 
zero or more page names?
Comment 4 Lupin 2006-02-02 18:12:59 UTC
I was envisioning using this with urls like

so I don't see how you can put more or less than one page name in there. 
Comment 5 Brion Vibber 2006-02-02 18:24:45 UTC
a) the WikiExport API accepts lists
b) you can POST as much as you like to the form handler
Comment 6 Lupin 2006-02-02 19:43:59 UTC
Created attachment 1346 [details]
patch supporting multiple old revisions

OK, this patch should fix those problems.
Comment 7 Brion Vibber 2006-02-02 20:00:21 UTC
This patch will break backup dumps, as it changes the export API and constants 
without updating the scripts using it.

Requiring a revision ID on each page seems like an unnecessary and undesireable 
breaking change. If this interface were used, it should be an optional parameter.

$oldid isn't checked for validity in several places in the API and gets dropped 
unescaped into SQL.

Notice errors will be thrown and either displayed or logged if oldids aren't 
passed or are too short for the list.

The table input interface doesn't look very nice.

Comment 8 Lupin 2006-02-02 20:27:16 UTC
Created attachment 1347 [details]
attempting to address brion's concerns

A revision is not required on each page - if the nth line in that field is
blank or not present, then the nth article is either retrieved in full or the
current revision is retrieved depending on $curonly, as currently happens.

$oldid is converted into an integer with intval(). Is that not sufficient? I'm
an sql neophyte, so I'm not sure what needs doing there, but I've added a few
more checks.

If $oldid is not a valid revision ID for the article, then nothing is added the
output, just as nothing is added to the output if a non-existent article is
requested. This seems OK to me.

I didn't know about error messages being spewed everywhere. How can I see them?
I've checked for keys being present, so hopefully that'll be fixed now.

Yes, the table is ugly, but I couldn't see a nicer way to do it. Do you have
any ideas? I've just omitted the interface on the special page altogether in
this patch, although it's useful for testing.
Comment 9 Brion Vibber 2006-02-02 20:38:40 UTC
This still breaks the API; several functions have added a required parameter which 
will be rarely used.

There's no change to the phpdoc about the new and changed parameters.

Looks like it will only work if the requested revision happens to be current or the 
full-history option is used (which is disabled site-wide on Wikimedia sites for 
Comment 10 Lupin 2006-02-02 20:40:27 UTC
Created attachment 1348 [details]
don't require $oldid in pagesByName
Comment 11 Lupin 2006-02-02 21:10:54 UTC
Created attachment 1349 [details]
another attempt

phpdoc strings added, of sorts. I think all the new parameters are documented
and optional now.

I've successfully tested this with $wgExportAllowHistory set to true and to
Comment 12 Brion Vibber 2006-02-02 21:41:45 UTC
Still adding required $oldid parameters onto existing API functions, breaking 
compatibility. The doc comments say 'optional' but the function definitions don't. 
It'll spew warnings when they're called from existing code.

More generally, I think what I'd like to see instead of tacking revision IDs onto 
the page list is to have an alternate mode entirely where you *just* pass a list of 
revision IDs.
Comment 13 Lupin 2006-02-02 23:13:08 UTC
Created attachment 1350 [details]
much nicer patch

Thanks Brion. A new mode is a much better way to do things.
Comment 14 Lupin 2006-02-03 13:02:17 UTC
Created attachment 1352 [details]
more flexible patch

This patch allows queries through Special:Export which don't return the article
text and which don't return the site information header. It adds two url
parameters: notext and nosite.

The idea is that this will make such queries more efficient when such
information is not desired.
Comment 15 Brion Vibber 2006-02-03 18:12:13 UTC
Export exists solely to provide that text, so I don't think those would be useful.
Comment 16 Lupin 2006-02-03 20:58:40 UTC
Created attachment 1356 [details]
"much nicer patch" reinstated

I've made the older "much nicer patch" supercede the "more flexible patch",
removing the notext and nosite flags. This patch just lets you send revision
IDs to Special:Export.
Comment 17 Rob Church 2006-04-16 16:09:57 UTC
*** Bug 5599 has been marked as a duplicate of this bug. ***
Comment 18 Siebrand Mazeland 2008-08-18 18:47:30 UTC
Mass compoment change: <some> -> Export/Import
Comment 19 Aaron Schulz 2008-09-19 12:42:02 UTC
What is the rationale for this?
Comment 20 Chad H. 2008-09-22 12:06:25 UTC
*** Bug 15687 has been marked as a duplicate of this bug. ***
Comment 21 Vitaliy Filippov 2010-03-18 14:23:17 UTC
See also Bug 22881 - Greatly improved Export and Import for 1.14.1 (with support for advanced page selection, exporting and importing file uploads, and detection of "conflicts" during import). There's a patch written by me which is related to or fixes your issue.
Comment 22 Sumana Harihareswara 2011-11-09 02:40:37 UTC
Lupin, I'm so sorry we're so late in responding to your patch.  I tried to apply it and it would no longer apply cleanly to trunk -- I think part of that is the formatting (see ).  If you'd like to work on this afresh, please visit #mediawiki in FreeNode IRC and chat with developers about the best approach.  Thanks, and again, sorry!
Comment 23 Andre Klapper 2014-07-07 12:18:20 UTC
Does this depend on bug 38669 (API export action does not support exporting specific revisions) or is that unrelated?
Comment 24 Étienne Beaulé 2014-07-21 02:22:06 UTC
(In reply to Andre Klapper from comment #23)
> Does this depend on bug 38669 (API export action does not support exporting
> specific revisions) or is that unrelated?

It seems to be.

Note You need to log in before you can comment on or make changes to this bug.