Page MenuHomePhabricator

Export all pages from a custom namespace
Open, LowPublicFeature

Description

Author: davidt

Description:
Ability to export a whole namespace.

I sometimes need to export all the pages from a custom namespace, to be able to transfer it to a different wiki. Attaching a tag to all the pages in a certain namespace didn't seem as the right way to do it.


Version: 1.13.x
Severity: enhancement

attachment mediawiki-1.13.5-exportNS.diff ignored as obsolete

Details

Reference
bz17886

Event Timeline

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

(In reply to comment #0)

Created an attachment (id=5903) [details]
Ability to export a whole namespace.

This patch uses a raw SQL query instead of using the Database.php wrappers, and doesn't limit its result in any way. Trying to export the main namespace on an enwiki-sized wiki would be a very expensive operation.

davidt wrote:

(In reply to comment #1)

(In reply to comment #0)

Created an attachment (id=5903) [details] [details]
Ability to export a whole namespace.

This patch uses a raw SQL query instead of using the Database.php wrappers, and
doesn't limit its result in any way. Trying to export the main namespace on an
enwiki-sized wiki would be a very expensive operation.

Hello Roan,

How is that different from the code in the function above it, that retrieves it by tag?
Where can I see the correct way to do it?

Thanks.

(In reply to comment #2)

(In reply to comment #1)

(In reply to comment #0)

Created an attachment (id=5903) [details] [details] [details]
Ability to export a whole namespace.

This patch uses a raw SQL query instead of using the Database.php wrappers, and
doesn't limit its result in any way. Trying to export the main namespace on an
enwiki-sized wiki would be a very expensive operation.

Hello Roan,

How is that different from the code in the function above it, that retrieves it
by tag?

It's not, probably, but that doesn't mean that's the right way to do it :)
There's still some hardcoded SQL left in the codebase.

Where can I see the correct way to do it?

Lots of examples all over the place, grep for "$dbr->select".

davidt wrote:

DB Wrappers for Special:Export by Tag and by Namespace functionality to use Database.php wrappers

Change for the Special:Export by Tag and by Namespace functionality to use Database.php wrappers.

attachment mediawiki-1.13.5-SpecialExport.patch ignored as obsolete

davidt wrote:

Patch against head

attachment mw-head-export-ns.patch ignored as obsolete

davidt wrote:

Special:Export a namespace, with a namespace selector against head

A new patch, using the namespace selector widget.

attachment mw-head-export-ns.patch ignored as obsolete

davidt wrote:

Updating the release-notes.

As instructed by ^demon.

Attached:

Mmmm, this doesn't look very sensible... will clearly break on large wikis, and just looks kind of awkward for small ones. Maybe needs some revamp.

davidt wrote:

(In reply to comment #9)

Mmmm, this doesn't look very sensible... will clearly break on large wikis, and
just looks kind of awkward for small ones. Maybe needs some revamp.

It's limited to 5000 results, so it won't break as such. It's a great way to transfer all the Templates from enwiki to a different wiki, or to transfer things between environments if you got smaller wikis, with different namespaces for different subjects.

The 5000 limit is only apparent if you read the source code. The end-user won't know he's not getting everything, so he'll just get some surprise data loss.

Bryan.TongMinh wrote:

Remove patch keyword until Brion's concerns have been addressed.

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.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Aklapper removed a subscriber: wikibugs-l-list.