Skip to content

Instantly share code, notes, and snippets.

@MarSoft
Created February 17, 2015 19:06
Show Gist options
  • Save MarSoft/ca00cecbd9d426d9e614 to your computer and use it in GitHub Desktop.
Save MarSoft/ca00cecbd9d426d9e614 to your computer and use it in GitHub Desktop.
--- git-remote-mediawiki 2014-04-08 16:44:48.779892220 +0400
+++ /usr/lib/git-core/git-remote-mediawiki 2014-04-08 17:57:02.812914836 +0400
@@ -54,6 +54,10 @@
my @tracked_categories = split(/[ \n]/, run_git("config --get-all remote.". $remotename .".categories"));
chomp(@tracked_categories);
+# Custom namespaces to use, in addition to main
+my @custom_namespaces = split(/[ \n]/, run_git("config --get remote.". $remotename .".namespaces"));
+chomp(@custom_namespaces);
+
# Import media files on pull
my $import_media = run_git("config --get --bool remote.". $remotename .".mediaimport");
chomp($import_media);
@@ -299,6 +303,18 @@
foreach my $page (@{$mw_pages}) {
$pages->{$page->{title}} = $page;
}
+ foreach my $namespace (@custom_namespaces) {
+ print "Fetching namespace $namespace\n";
+ $mw_pages = $mediawiki->list({
+ action => 'query',
+ list => 'allpages',
+ apnamespace => get_mw_namespace_id($namespace),
+ aplimit => 'max'
+ });
+ foreach my $page (@{$mw_pages}) {
+ $pages->{$page->{title}} = $page;
+ }
+ }
}
# queries the wiki for a set of pages. Meant to be used within a loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment