$maxHistory = $config->get( 'ExportMaxHistory' );
$limit = $request->getInt( 'limit' );
$dir = $request->getVal( 'dir' );
- $history = array(
+ $history = [
'dir' => 'asc',
'offset' => false,
'limit' => $maxHistory,
- );
+ ];
$historyCheck = $request->getCheck( 'history' );
if ( $this->curonly ) {
// This should provide safer streaming for pages with history
wfResetOutputBuffers();
$request->response()->header( "Content-type: application/xml; charset=utf-8" );
+ $request->response()->header( "X-Robots-Tag: noindex,nofollow" );
if ( $request->getCheck( 'wpDownload' ) ) {
// Provide a sane filename suggestion
$categoryName = '';
}
- $formDescriptor = array(
- 'catname' => array(
+ $formDescriptor = [
+ 'catname' => [
'type' => 'textwithbutton',
'name' => 'catname',
'horizontal-label' => true,
'buttontype' => 'submit',
'buttonname' => 'addcat',
'buttondefault' => $this->msg( 'export-addcat' )->text(),
- ),
- );
+ ],
+ ];
if ( $config->get( 'ExportFromNamespaces' ) ) {
- $formDescriptor += array(
- 'nsindex' => array(
+ $formDescriptor += [
+ 'nsindex' => [
'type' => 'namespaceselectwithbutton',
'default' => $nsindex,
'label-message' => 'export-addnstext',
'buttontype' => 'submit',
'buttonname' => 'addns',
'buttondefault' => $this->msg( 'export-addns' )->text(),
- ),
- );
+ ],
+ ];
}
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,
- ),
- );
+ ],
+ ];
}
- $formDescriptor += array(
- 'textarea' => array(
+ $formDescriptor += [
+ 'textarea' => [
'class' => 'HTMLTextAreaField',
'name' => 'pages',
'label-message' => 'export-manual',
'nodata' => true,
'rows' => 10,
'default' => $page,
- ),
- );
+ ],
+ ];
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,
- ),
- );
+ ],
+ ];
} 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,
- ),
- );
+ ],
+ ];
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,
- ),
- );
+ ],
+ ];
}
- $formDescriptor += array(
- 'wpDownload' => array(
+ $formDescriptor += [
+ 'wpDownload' => [
'type' => 'check',
'name' =>'wpDownload',
'id' => 'wpDownload',
'default' => $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true,
'label-message' => 'export-download',
- ),
- );
+ ],
+ ];
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',
- ),
- );
+ ],
+ ];
}
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
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 ) {
$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__,
- array( 'LIMIT' => $maxPages )
+ [ 'LIMIT' => $maxPages ]
);
- $pages = array();
+ $pages = [];
foreach ( $res as $row ) {
$n = $row->page_title;
$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__,
- array( 'LIMIT' => $maxPages )
+ [ 'LIMIT' => $maxPages ]
);
- $pages = array();
+ $pages = [];
foreach ( $res as $row ) {
$n = $row->page_title;
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' ]
);
}
// @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 );
}
/// @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,
- array(
+ [
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey()
- )
+ ]
),
__METHOD__
);