dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make export depth > 1 actually work. :) Assuming it doesn't bomb and die using too...
[lhc/web/wiklou.git]
/
includes
/
specials
/
SpecialExport.php
diff --git
a/includes/specials/SpecialExport.php
b/includes/specials/SpecialExport.php
index
83d0bbf
..
06bf34a
100644
(file)
--- a/
includes/specials/SpecialExport.php
+++ b/
includes/specials/SpecialExport.php
@@
-33,6
+33,7
@@
class SpecialExport extends SpecialPage {
public function execute( $par ) {
global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors;
global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth;
public function execute( $par ) {
global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors;
global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth;
+ global $wgExportFromNamespaces;
$this->setHeaders();
$this->outputHeader();
$this->setHeaders();
$this->outputHeader();
@@
-44,6
+45,7
@@
class SpecialExport extends SpecialPage {
$this->images = $wgRequest->getCheck( 'images' ); // Doesn't do anything yet
$this->pageLinkDepth = $this->validateLinkDepth(
$wgRequest->getIntOrNull( 'pagelink-depth' ) );
$this->images = $wgRequest->getCheck( 'images' ); // Doesn't do anything yet
$this->pageLinkDepth = $this->validateLinkDepth(
$wgRequest->getIntOrNull( 'pagelink-depth' ) );
+ $nsindex = '';
if ( $wgRequest->getCheck( 'addcat' ) ) {
$page = $wgRequest->getText( 'pages' );
if ( $wgRequest->getCheck( 'addcat' ) ) {
$page = $wgRequest->getText( 'pages' );
@@
-62,11
+64,11
@@
class SpecialExport extends SpecialPage {
}
}
}
}
}
}
- else if( $wgRequest->getCheck( 'addns' ) ) {
+ else if( $wgRequest->getCheck( 'addns' )
&& $wgExportFromNamespaces
) {
$page = $wgRequest->getText( 'pages' );
$page = $wgRequest->getText( 'pages' );
- $nsindex = $wgRequest->getText( 'nsindex' );
+ $nsindex = $wgRequest->getText( 'nsindex'
, ''
);
- if ( $nsindex !== '' && $nsindex !==
NULL
&& $nsindex !== false ) {
+ if ( $nsindex !== '' && $nsindex !==
null
&& $nsindex !== false ) {
/**
* Same implementation as above, so same @fixme
*/
/**
* Same implementation as above, so same @fixme
*/
@@
-149,8
+151,10
@@
class SpecialExport extends SpecialPage {
$form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' ';
$form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
$form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' ';
$form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
- $form .= Xml::namespaceSelector( '', null, 'nsindex', wfMsg( 'export-addnstext' ) ) . ' ';
- $form .= Xml::submitButton( wfMsg( 'export-addns' ), array( 'name' => 'addns' ) ) . '<br />';
+ if ( $wgExportFromNamespaces ) {
+ $form .= Xml::namespaceSelector( $nsindex, null, 'nsindex', wfMsg( 'export-addnstext' ) ) . ' ';
+ $form .= Xml::submitButton( wfMsg( 'export-addns' ), array( 'name' => 'addns' ) ) . '<br />';
+ }
$form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $page, false );
$form .= '<br />';
$form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $page, false );
$form .= '<br />';
@@
-175,8
+179,8
@@
class SpecialExport extends SpecialPage {
private function userCanOverrideExportDepth() {
global $wgUser;
private function userCanOverrideExportDepth() {
global $wgUser;
-
- return
in_array( 'override-export-depth', $wgUser->getRights()
);
+
+ return
$wgUser->isAllowed( 'override-export-depth'
);
}
/**
}
/**
@@
-207,7
+211,13
@@
class SpecialExport extends SpecialPage {
*/
$pages = array_keys( $pageSet );
*/
$pages = array_keys( $pageSet );
-
+
+ // Normalize titles to the same format and remove dupes, see bug 17374
+ foreach( $pages as $k => $v ) {
+ $pages[$k] = str_replace( " ", "_", $v );
+ }
+ $pages = array_unique( $pages );
+
/* Ok, let's get to it... */
if( $history == WikiExporter::CURRENT ) {
$lb = false;
/* Ok, let's get to it... */
if( $history == WikiExporter::CURRENT ) {
$lb = false;
@@
-343,6
+353,7
@@
class SpecialExport extends SpecialPage {
$pageSet = $this->getLinks( $inputPages, $pageSet, 'pagelinks',
array( 'pl_namespace AS namespace', 'pl_title AS title' ),
array( 'page_id=pl_from' ) );
$pageSet = $this->getLinks( $inputPages, $pageSet, 'pagelinks',
array( 'pl_namespace AS namespace', 'pl_title AS title' ),
array( 'page_id=pl_from' ) );
+ $inputPages = array_keys( $pageSet );
}
return $pageSet;
}
}
return $pageSet;
}