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
Merge "Use WatchedItemStore::countWatchers in SpecialWatchlist"
[lhc/web/wiklou.git]
/
includes
/
specials
/
SpecialExport.php
diff --git
a/includes/specials/SpecialExport.php
b/includes/specials/SpecialExport.php
index
3ce9c76
..
ede367e
100644
(file)
--- a/
includes/specials/SpecialExport.php
+++ b/
includes/specials/SpecialExport.php
@@
-109,11
+109,11
@@
class SpecialExport extends SpecialPage {
$maxHistory = $config->get( 'ExportMaxHistory' );
$limit = $request->getInt( 'limit' );
$dir = $request->getVal( 'dir' );
$maxHistory = $config->get( 'ExportMaxHistory' );
$limit = $request->getInt( 'limit' );
$dir = $request->getVal( 'dir' );
- $history =
array(
+ $history =
[
'dir' => 'asc',
'offset' => false,
'limit' => $maxHistory,
'dir' => 'asc',
'offset' => false,
'limit' => $maxHistory,
-
)
;
+
]
;
$historyCheck = $request->getCheck( 'history' );
if ( $this->curonly ) {
$historyCheck = $request->getCheck( 'history' );
if ( $this->curonly ) {
@@
-189,8
+189,8
@@
class SpecialExport extends SpecialPage {
$categoryName = '';
}
$categoryName = '';
}
- $formDescriptor =
array(
- 'catname' =>
array(
+ $formDescriptor =
[
+ 'catname' =>
[
'type' => 'textwithbutton',
'name' => 'catname',
'horizontal-label' => true,
'type' => 'textwithbutton',
'name' => 'catname',
'horizontal-label' => true,
@@
-200,11
+200,11
@@
class SpecialExport extends SpecialPage {
'buttontype' => 'submit',
'buttonname' => 'addcat',
'buttondefault' => $this->msg( 'export-addcat' )->text(),
'buttontype' => 'submit',
'buttonname' => 'addcat',
'buttondefault' => $this->msg( 'export-addcat' )->text(),
-
)
,
-
)
;
+
]
,
+
]
;
if ( $config->get( 'ExportFromNamespaces' ) ) {
if ( $config->get( 'ExportFromNamespaces' ) ) {
- $formDescriptor +=
array(
- 'nsindex' =>
array(
+ $formDescriptor +=
[
+ 'nsindex' =>
[
'type' => 'namespaceselectwithbutton',
'default' => $nsindex,
'label-message' => 'export-addnstext',
'type' => 'namespaceselectwithbutton',
'default' => $nsindex,
'label-message' => 'export-addnstext',
@@
-215,90
+215,90
@@
class SpecialExport extends SpecialPage {
'buttontype' => 'submit',
'buttonname' => 'addns',
'buttondefault' => $this->msg( 'export-addns' )->text(),
'buttontype' => 'submit',
'buttonname' => 'addns',
'buttondefault' => $this->msg( 'export-addns' )->text(),
-
)
,
-
)
;
+
]
,
+
]
;
}
if ( $config->get( 'ExportAllowAll' ) ) {
}
if ( $config->get( 'ExportAllowAll' ) ) {
- $formDescriptor +=
array(
- 'exportall' =>
array(
+ $formDescriptor +=
[
+ 'exportall' =>
[
'type' => 'check',
'label-message' => 'exportall',
'name' => 'exportall',
'id' => 'exportall',
'default' => $request->wasPosted() ? $request->getCheck( 'exportall' ) : false,
'type' => 'check',
'label-message' => 'exportall',
'name' => 'exportall',
'id' => 'exportall',
'default' => $request->wasPosted() ? $request->getCheck( 'exportall' ) : false,
-
)
,
-
)
;
+
]
,
+
]
;
}
}
- $formDescriptor +=
array(
- 'textarea' =>
array(
+ $formDescriptor +=
[
+ 'textarea' =>
[
'class' => 'HTMLTextAreaField',
'name' => 'pages',
'label-message' => 'export-manual',
'nodata' => true,
'rows' => 10,
'default' => $page,
'class' => 'HTMLTextAreaField',
'name' => 'pages',
'label-message' => 'export-manual',
'nodata' => true,
'rows' => 10,
'default' => $page,
-
)
,
-
)
;
+
]
,
+
]
;
if ( $config->get( 'ExportAllowHistory' ) ) {
if ( $config->get( 'ExportAllowHistory' ) ) {
- $formDescriptor +=
array(
- 'curonly' =>
array(
+ $formDescriptor +=
[
+ 'curonly' =>
[
'type' => 'check',
'label-message' => 'exportcuronly',
'name' => 'curonly',
'id' => 'curonly',
'default' => $request->wasPosted() ? $request->getCheck( 'curonly' ) : true,
'type' => 'check',
'label-message' => 'exportcuronly',
'name' => 'curonly',
'id' => 'curonly',
'default' => $request->wasPosted() ? $request->getCheck( 'curonly' ) : true,
-
)
,
-
)
;
+
]
,
+
]
;
} else {
$out->addWikiMsg( 'exportnohistory' );
}
} else {
$out->addWikiMsg( 'exportnohistory' );
}
- $formDescriptor +=
array(
- 'templates' =>
array(
+ $formDescriptor +=
[
+ 'templates' =>
[
'type' => 'check',
'label-message' => 'export-templates',
'name' => 'templates',
'id' => 'wpExportTemplates',
'default' => $request->wasPosted() ? $request->getCheck( 'templates' ) : false,
'type' => 'check',
'label-message' => 'export-templates',
'name' => 'templates',
'id' => 'wpExportTemplates',
'default' => $request->wasPosted() ? $request->getCheck( 'templates' ) : false,
-
)
,
-
)
;
+
]
,
+
]
;
if ( $config->get( 'ExportMaxLinkDepth' ) || $this->userCanOverrideExportDepth() ) {
if ( $config->get( 'ExportMaxLinkDepth' ) || $this->userCanOverrideExportDepth() ) {
- $formDescriptor +=
array(
- 'pagelink-depth' =>
array(
+ $formDescriptor +=
[
+ 'pagelink-depth' =>
[
'type' => 'text',
'name' => 'pagelink-depth',
'id' => 'pagelink-depth',
'label-message' => 'export-pagelinks',
'default' => '0',
'size' => 20,
'type' => 'text',
'name' => 'pagelink-depth',
'id' => 'pagelink-depth',
'label-message' => 'export-pagelinks',
'default' => '0',
'size' => 20,
-
)
,
-
)
;
+
]
,
+
]
;
}
}
- $formDescriptor +=
array(
- 'wpDownload' =>
array(
+ $formDescriptor +=
[
+ 'wpDownload' =>
[
'type' => 'check',
'name' =>'wpDownload',
'id' => 'wpDownload',
'default' => $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true,
'label-message' => 'export-download',
'type' => 'check',
'name' =>'wpDownload',
'id' => 'wpDownload',
'default' => $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true,
'label-message' => 'export-download',
-
)
,
-
)
;
+
]
,
+
]
;
if ( $config->get( 'ExportAllowListContributors' ) ) {
if ( $config->get( 'ExportAllowListContributors' ) ) {
- $formDescriptor +=
array(
- 'listauthors' =>
array(
+ $formDescriptor +=
[
+ 'listauthors' =>
[
'type' => 'check',
'label-message' => 'exportlistauthors',
'default' => $request->wasPosted() ? $request->getCheck( 'listauthors' ) : false,
'name' => 'listauthors',
'id' => 'listauthors',
'type' => 'check',
'label-message' => 'exportlistauthors',
'default' => $request->wasPosted() ? $request->getCheck( 'listauthors' ) : false,
'name' => 'listauthors',
'id' => 'listauthors',
-
)
,
-
)
;
+
]
,
+
]
;
}
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
}
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
@@
-329,7
+329,7
@@
class SpecialExport extends SpecialPage {
if ( $exportall ) {
$history = WikiExporter::FULL;
} else {
if ( $exportall ) {
$history = WikiExporter::FULL;
} else {
- $pageSet =
array()
; // Inverted index of all pages to look up
+ $pageSet =
[]
; // Inverted index of all pages to look up
// Split up and normalize input
foreach ( explode( "\n", $page ) as $pageName ) {
// Split up and normalize input
foreach ( explode( "\n", $page ) as $pageName ) {
@@
-418,18
+418,20
@@
class SpecialExport extends SpecialPage {
private function getPagesFromCategory( $title ) {
global $wgContLang;
private function getPagesFromCategory( $title ) {
global $wgContLang;
+ $maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
+
$name = $title->getDBkey();
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
$name = $title->getDBkey();
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
-
array( 'page', 'categorylinks' )
,
-
array( 'page_namespace', 'page_title' )
,
-
array( 'cl_from=page_id', 'cl_to' => $name )
,
+
[ 'page', 'categorylinks' ]
,
+
[ 'page_namespace', 'page_title' ]
,
+
[ 'cl_from=page_id', 'cl_to' => $name ]
,
__METHOD__,
__METHOD__,
- array( 'LIMIT' => '5000' )
+ [ 'LIMIT' => $maxPages ]
);
);
- $pages =
array()
;
+ $pages =
[]
;
foreach ( $res as $row ) {
$n = $row->page_title;
foreach ( $res as $row ) {
$n = $row->page_title;
@@
-451,16
+453,18
@@
class SpecialExport extends SpecialPage {
private function getPagesFromNamespace( $nsindex ) {
global $wgContLang;
private function getPagesFromNamespace( $nsindex ) {
global $wgContLang;
+ $maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
+
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
'page',
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
'page',
-
array( 'page_namespace', 'page_title' )
,
-
array( 'page_namespace' => $nsindex )
,
+
[ 'page_namespace', 'page_title' ]
,
+
[ 'page_namespace' => $nsindex ]
,
__METHOD__,
__METHOD__,
- array( 'LIMIT' => '5000' )
+ [ 'LIMIT' => $maxPages ]
);
);
- $pages =
array()
;
+ $pages =
[]
;
foreach ( $res as $row ) {
$n = $row->page_title;
foreach ( $res as $row ) {
$n = $row->page_title;
@@
-485,8
+489,8
@@
class SpecialExport extends SpecialPage {
private function getTemplates( $inputPages, $pageSet ) {
return $this->getLinks( $inputPages, $pageSet,
'templatelinks',
private function getTemplates( $inputPages, $pageSet ) {
return $this->getLinks( $inputPages, $pageSet,
'templatelinks',
-
array( 'namespace' => 'tl_namespace', 'title' => 'tl_title' )
,
- array( 'page_id=tl_from' )
+
[ 'namespace' => 'tl_namespace', 'title' => 'tl_title' ]
,
+ [ 'page_id=tl_from' ]
);
}
);
}
@@
-529,8
+533,8
@@
class SpecialExport extends SpecialPage {
// @codingStandardsIgnoreEnd
$pageSet = $this->getLinks(
$inputPages, $pageSet, 'pagelinks',
// @codingStandardsIgnoreEnd
$pageSet = $this->getLinks(
$inputPages, $pageSet, 'pagelinks',
-
array( 'namespace' => 'pl_namespace', 'title' => 'pl_title' )
,
- array( 'page_id=pl_from' )
+
[ 'namespace' => 'pl_namespace', 'title' => 'pl_title' ]
,
+ [ 'page_id=pl_from' ]
);
$inputPages = array_keys( $pageSet );
}
);
$inputPages = array_keys( $pageSet );
}
@@
-558,14
+562,14
@@
class SpecialExport extends SpecialPage {
/// @todo FIXME: May or may not be more efficient to batch these
/// by namespace when given multiple input pages.
$result = $dbr->select(
/// @todo FIXME: May or may not be more efficient to batch these
/// by namespace when given multiple input pages.
$result = $dbr->select(
-
array( 'page', $table )
,
+
[ 'page', $table ]
,
$fields,
array_merge(
$join,
$fields,
array_merge(
$join,
- array(
+ [
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey()
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey()
- )
+ ]
),
__METHOD__
);
),
__METHOD__
);