Go to the documentation of this file.
36 parent::__construct(
'Export' );
40 global $wgSitename, $wgExportAllowListContributors, $wgExportFromNamespaces;
41 global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth;
48 $this->curonly =
true;
51 $this->templates = $request->getCheck(
'templates' );
52 $this->images = $request->getCheck(
'images' );
54 $request->getIntOrNull(
'pagelink-depth' )
59 if ( $request->getCheck(
'addcat' ) ) {
60 $page = $request->getText(
'pages' );
61 $catname = $request->getText(
'catname' );
63 if ( $catname !==
'' && $catname !==
null && $catname !==
false ) {
73 $page .=
"\n" . implode(
"\n", $catpages );
77 } elseif ( $request->getCheck(
'addns' ) && $wgExportFromNamespaces ) {
78 $page = $request->getText(
'pages' );
79 $nsindex = $request->getText(
'nsindex',
'' );
81 if ( strval( $nsindex ) !==
'' ) {
87 $page .=
"\n" . implode(
"\n", $nspages );
90 } elseif ( $request->getCheck(
'exportall' ) && $wgExportAllowAll ) {
100 } elseif ( $request->wasPosted() && $par ==
'' ) {
101 $page = $request->getText(
'pages' );
102 $this->curonly = $request->getCheck(
'curonly' );
103 $rawOffset = $request->getVal(
'offset' );
111 $limit = $request->getInt(
'limit' );
112 $dir = $request->getVal(
'dir' );
116 'limit' => $wgExportMaxHistory,
118 $historyCheck = $request->getCheck(
'history' );
120 if ( $this->curonly ) {
122 } elseif ( !$historyCheck ) {
123 if (
$limit > 0 && ( $wgExportMaxHistory == 0 ||
$limit < $wgExportMaxHistory ) ) {
124 $history[
'limit'] =
$limit;
127 if ( !is_null( $offset ) ) {
128 $history[
'offset'] = $offset;
131 if ( strtolower(
$dir ) ==
'desc' ) {
132 $history[
'dir'] =
'desc';
141 $page = $request->getText(
'pages', $par );
142 $historyCheck = $request->getCheck(
'history' );
144 if ( $historyCheck ) {
155 if ( !$wgExportAllowHistory ) {
160 $list_authors = $request->getCheck(
'listauthors' );
161 if ( !$this->curonly || !$wgExportAllowListContributors ) {
162 $list_authors =
false;
171 $request->response()->header(
"Content-type: application/xml; charset=utf-8" );
173 if ( $request->getCheck(
'wpDownload' ) ) {
175 $filename = urlencode( $wgSitename .
'-' .
wfTimestampNow() .
'.xml' );
176 $request->response()->header(
"Content-disposition: attachment;filename={$filename}" );
179 $this->
doExport( $page, $history, $list_authors, $exportall );
185 $out->addWikiMsg(
'exporttext' );
188 'action' => $this->
getPageTitle()->getLocalURL(
'action=submit' ) ) );
190 $this->
msg(
'export-addcattext' )->
text(),
196 $this->
msg(
'export-addcat' )->
text(),
197 array(
'name' =>
'addcat' )
200 if ( $wgExportFromNamespaces ) {
203 'selected' => $nsindex,
204 'label' => $this->
msg(
'export-addnstext' )->
text()
208 'class' =>
'namespaceselector',
212 $this->
msg(
'export-addns' )->
text(),
213 array(
'name' =>
'addns' )
217 if ( $wgExportAllowAll ) {
219 $this->
msg(
'exportall' )->
text(),
222 $request->wasPosted() ? $request->getCheck(
'exportall' ) :
false
228 array(
'name' =>
'pages',
'cols' => 40,
'rows' => 10 ),
234 if ( $wgExportAllowHistory ) {
236 $this->
msg(
'exportcuronly' )->
text(),
239 $request->wasPosted() ? $request->getCheck(
'curonly' ) :
true
242 $out->addWikiMsg(
'exportnohistory' );
246 $this->
msg(
'export-templates' )->
text(),
249 $request->wasPosted() ? $request->getCheck(
'templates' ) :
false
254 $this->
msg(
'export-pagelinks' )->
text(),
265 $this->
msg(
'export-download' )->
text(),
268 $request->wasPosted() ? $request->getCheck(
'wpDownload' ) :
true
271 if ( $wgExportAllowListContributors ) {
273 $this->
msg(
'exportlistauthors' )->
text(),
276 $request->wasPosted() ? $request->getCheck(
'listauthors' ) :
false
281 $this->
msg(
'export-submit' )->
text(),
293 return $this->
getUser()->isAllowed(
'override-export-depth' );
305 private function doExport( $page, $history, $list_authors, $exportall ) {
315 foreach ( explode(
"\n", $page )
as $pageName ) {
316 $pageName = trim( $pageName );
320 $pageSet[
$title->getPrefixedText()] =
true;
325 $inputPages = array_keys( $pageSet );
328 if ( $this->templates ) {
329 $pageSet = $this->
getTemplates( $inputPages, $pageSet );
333 $pageSet = $this->
getPageLinks( $inputPages, $pageSet, $linkDepth );
341 $pages = array_keys( $pageSet );
344 foreach ( $pages
as $k => $v ) {
345 $pages[$k] = str_replace(
" ",
"_", $v );
348 $pages = array_unique( $pages );
369 $exporter->list_authors = $list_authors;
370 $exporter->openStream();
373 $exporter->allPages();
375 foreach ( $pages
as $page ) {
376 #Bug 8824: Only export pages the user can read
378 if ( is_null(
$title ) ) {
383 if ( !
$title->userCan(
'read', $this->getUser() ) ) {
388 $exporter->pageByTitle(
$title );
392 $exporter->closeStream();
410 array(
'page',
'categorylinks' ),
411 array(
'page_namespace',
'page_title' ),
414 array(
'LIMIT' =>
'5000' )
419 foreach (
$res as $row ) {
420 $n = $row->page_title;
421 if ( $row->page_namespace ) {
422 $ns =
$wgContLang->getNsText( $row->page_namespace );
442 array(
'page_namespace',
'page_title' ),
443 array(
'page_namespace' => $nsindex ),
445 array(
'LIMIT' =>
'5000' )
450 foreach (
$res as $row ) {
451 $n = $row->page_title;
453 if ( $row->page_namespace ) {
454 $ns =
$wgContLang->getNsText( $row->page_namespace );
471 return $this->
getLinks( $inputPages, $pageSet,
473 array(
'namespace' =>
'tl_namespace',
'title' =>
'tl_title' ),
474 array(
'page_id=tl_from' )
484 global $wgExportMaxLinkDepth;
491 if ( $depth > $wgExportMaxLinkDepth ) {
492 return $wgExportMaxLinkDepth;
502 return intval( min( $depth, 5 ) );
513 for ( ; $depth > 0; --$depth ) {
515 $inputPages, $pageSet,
'pagelinks',
516 array(
'namespace' =>
'pl_namespace',
'title' =>
'pl_title' ),
517 array(
'page_id=pl_from' )
519 $inputPages = array_keys( $pageSet );
539 array(
'page_id=il_from' )
552 private function getLinks( $inputPages, $pageSet, $table, $fields, $join ) {
555 foreach ( $inputPages
as $page ) {
559 $pageSet[
$title->getPrefixedText()] =
true;
563 array(
'page', $table ),
568 'page_namespace' =>
$title->getNamespace(),
569 'page_title' =>
$title->getDBkey()
577 $pageSet[$template->getPrefixedText()] =
true;
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
getPageTitle( $subpage=false)
Get a self-referential title object.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getLinks( $inputPages, $pageSet, $table, $fields, $join)
Expand a list of pages to include items used in those pages.
wfResetOutputBuffers( $resetGzipEncoding=true)
Clear away any user-level output buffers, discarding contents.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
A special page that allows users to export pages in a XML file.
getOutput()
Get the OutputPage being used for this instance.
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
getImages( $inputPages, $pageSet)
Expand a list of pages to include images used in those pages.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
getTemplates( $inputPages, $pageSet)
Expand a list of pages to include templates used in those pages.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
doExport( $page, $history, $list_authors, $exportall)
Do the actual page exporting.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
static openElement( $element, $attribs=null)
This opens an XML element.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
static tooltipAndAccesskeyAttribs( $name)
Returns the attributes for the tooltip and access key.
getPagesFromCategory( $title)
if( $wgAPIRequestLog) $lb
wfRestoreWarnings()
Restore error level to previous value.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getPageLinks( $inputPages, $pageSet, $depth)
Expand a list of pages to include pages linked to from that page.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field with a label.
when a variable name is used in a it is silently declared as a new masking the global
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
processing should stop and the error should be shown to the user * false
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
Parent class for all special pages.
getRequest()
Get the WebRequest being used for this instance.
validateLinkDepth( $depth)
Validate link depth setting, if available.
getPagesFromNamespace( $nsindex)
static closeElement( $element)
Shortcut to close an XML element.
& wfGetLBFactory()
Get the load balancer factory object.
if(count( $args)==0) $dir
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
userCanOverrideExportDepth()