MediaWiki  1.33.1
SpecialExport.php
Go to the documentation of this file.
1 <?php
27 
33 class SpecialExport extends SpecialPage {
35 
36  public function __construct() {
37  parent::__construct( 'Export' );
38  }
39 
40  public function execute( $par ) {
41  $this->setHeaders();
42  $this->outputHeader();
43  $config = $this->getConfig();
44 
45  // Set some variables
46  $this->curonly = true;
47  $this->doExport = false;
48  $request = $this->getRequest();
49  $this->templates = $request->getCheck( 'templates' );
50  $this->pageLinkDepth = $this->validateLinkDepth(
51  $request->getIntOrNull( 'pagelink-depth' )
52  );
53  $nsindex = '';
54  $exportall = false;
55 
56  if ( $request->getCheck( 'addcat' ) ) {
57  $page = $request->getText( 'pages' );
58  $catname = $request->getText( 'catname' );
59 
60  if ( $catname !== '' && $catname !== null && $catname !== false ) {
61  $t = Title::makeTitleSafe( NS_MAIN, $catname );
62  if ( $t ) {
68  $catpages = $this->getPagesFromCategory( $t );
69  if ( $catpages ) {
70  if ( $page !== '' ) {
71  $page .= "\n";
72  }
73  $page .= implode( "\n", $catpages );
74  }
75  }
76  }
77  } elseif ( $request->getCheck( 'addns' ) && $config->get( 'ExportFromNamespaces' ) ) {
78  $page = $request->getText( 'pages' );
79  $nsindex = $request->getText( 'nsindex', '' );
80 
81  if ( strval( $nsindex ) !== '' ) {
85  $nspages = $this->getPagesFromNamespace( $nsindex );
86  if ( $nspages ) {
87  $page .= "\n" . implode( "\n", $nspages );
88  }
89  }
90  } elseif ( $request->getCheck( 'exportall' ) && $config->get( 'ExportAllowAll' ) ) {
91  $this->doExport = true;
92  $exportall = true;
93 
94  /* Although $page and $history are not used later on, we
95  nevertheless set them to avoid that PHP notices about using
96  undefined variables foul up our XML output (see call to
97  doExport(...) further down) */
98  $page = '';
99  $history = '';
100  } elseif ( $request->wasPosted() && $par == '' ) {
101  // Log to see if certain parameters are actually used.
102  // If not, we could deprecate them and do some cleanup, here and in WikiExporter.
103  LoggerFactory::getInstance( 'export' )->debug(
104  'Special:Export POST, dir: [{dir}], offset: [{offset}], limit: [{limit}]', [
105  'dir' => $request->getRawVal( 'dir' ),
106  'offset' => $request->getRawVal( 'offset' ),
107  'limit' => $request->getRawVal( 'limit' ),
108  ] );
109 
110  $page = $request->getText( 'pages' );
111  $this->curonly = $request->getCheck( 'curonly' );
112  $rawOffset = $request->getVal( 'offset' );
113 
114  if ( $rawOffset ) {
115  $offset = wfTimestamp( TS_MW, $rawOffset );
116  } else {
117  $offset = null;
118  }
119 
120  $maxHistory = $config->get( 'ExportMaxHistory' );
121  $limit = $request->getInt( 'limit' );
122  $dir = $request->getVal( 'dir' );
123  $history = [
124  'dir' => 'asc',
125  'offset' => false,
126  'limit' => $maxHistory,
127  ];
128  $historyCheck = $request->getCheck( 'history' );
129 
130  if ( $this->curonly ) {
131  $history = WikiExporter::CURRENT;
132  } elseif ( !$historyCheck ) {
133  if ( $limit > 0 && ( $maxHistory == 0 || $limit < $maxHistory ) ) {
134  $history['limit'] = $limit;
135  }
136 
137  if ( !is_null( $offset ) ) {
138  $history['offset'] = $offset;
139  }
140 
141  if ( strtolower( $dir ) == 'desc' ) {
142  $history['dir'] = 'desc';
143  }
144  }
145 
146  if ( $page != '' ) {
147  $this->doExport = true;
148  }
149  } else {
150  // Default to current-only for GET requests.
151  $page = $request->getText( 'pages', $par );
152  $historyCheck = $request->getCheck( 'history' );
153 
154  if ( $historyCheck ) {
155  $history = WikiExporter::FULL;
156  } else {
157  $history = WikiExporter::CURRENT;
158  }
159 
160  if ( $page != '' ) {
161  $this->doExport = true;
162  }
163  }
164 
165  if ( !$config->get( 'ExportAllowHistory' ) ) {
166  // Override
167  $history = WikiExporter::CURRENT;
168  }
169 
170  $list_authors = $request->getCheck( 'listauthors' );
171  if ( !$this->curonly || !$config->get( 'ExportAllowListContributors' ) ) {
172  $list_authors = false;
173  }
174 
175  if ( $this->doExport ) {
176  $this->getOutput()->disable();
177 
178  // Cancel output buffering and gzipping if set
179  // This should provide safer streaming for pages with history
181  $request->response()->header( "Content-type: application/xml; charset=utf-8" );
182  $request->response()->header( "X-Robots-Tag: noindex,nofollow" );
183 
184  if ( $request->getCheck( 'wpDownload' ) ) {
185  // Provide a sane filename suggestion
186  $filename = urlencode( $config->get( 'Sitename' ) . '-' . wfTimestampNow() . '.xml' );
187  $request->response()->header( "Content-disposition: attachment;filename={$filename}" );
188  }
189 
190  $this->doExport( $page, $history, $list_authors, $exportall );
191 
192  return;
193  }
194 
195  $out = $this->getOutput();
196  $out->addWikiMsg( 'exporttext' );
197 
198  if ( $page == '' ) {
199  $categoryName = $request->getText( 'catname' );
200  } else {
201  $categoryName = '';
202  }
203 
204  $formDescriptor = [
205  'catname' => [
206  'type' => 'textwithbutton',
207  'name' => 'catname',
208  'horizontal-label' => true,
209  'label-message' => 'export-addcattext',
210  'default' => $categoryName,
211  'size' => 40,
212  'buttontype' => 'submit',
213  'buttonname' => 'addcat',
214  'buttondefault' => $this->msg( 'export-addcat' )->text(),
215  'hide-if' => [ '===', 'exportall', '1' ],
216  ],
217  ];
218  if ( $config->get( 'ExportFromNamespaces' ) ) {
219  $formDescriptor += [
220  'nsindex' => [
221  'type' => 'namespaceselectwithbutton',
222  'default' => $nsindex,
223  'label-message' => 'export-addnstext',
224  'horizontal-label' => true,
225  'name' => 'nsindex',
226  'id' => 'namespace',
227  'cssclass' => 'namespaceselector',
228  'buttontype' => 'submit',
229  'buttonname' => 'addns',
230  'buttondefault' => $this->msg( 'export-addns' )->text(),
231  'hide-if' => [ '===', 'exportall', '1' ],
232  ],
233  ];
234  }
235 
236  if ( $config->get( 'ExportAllowAll' ) ) {
237  $formDescriptor += [
238  'exportall' => [
239  'type' => 'check',
240  'label-message' => 'exportall',
241  'name' => 'exportall',
242  'id' => 'exportall',
243  'default' => $request->wasPosted() ? $request->getCheck( 'exportall' ) : false,
244  ],
245  ];
246  }
247 
248  $formDescriptor += [
249  'textarea' => [
250  'class' => HTMLTextAreaField::class,
251  'name' => 'pages',
252  'label-message' => 'export-manual',
253  'nodata' => true,
254  'rows' => 10,
255  'default' => $page,
256  'hide-if' => [ '===', 'exportall', '1' ],
257  ],
258  ];
259 
260  if ( $config->get( 'ExportAllowHistory' ) ) {
261  $formDescriptor += [
262  'curonly' => [
263  'type' => 'check',
264  'label-message' => 'exportcuronly',
265  'name' => 'curonly',
266  'id' => 'curonly',
267  'default' => $request->wasPosted() ? $request->getCheck( 'curonly' ) : true,
268  ],
269  ];
270  } else {
271  $out->addWikiMsg( 'exportnohistory' );
272  }
273 
274  $formDescriptor += [
275  'templates' => [
276  'type' => 'check',
277  'label-message' => 'export-templates',
278  'name' => 'templates',
279  'id' => 'wpExportTemplates',
280  'default' => $request->wasPosted() ? $request->getCheck( 'templates' ) : false,
281  ],
282  ];
283 
284  if ( $config->get( 'ExportMaxLinkDepth' ) || $this->userCanOverrideExportDepth() ) {
285  $formDescriptor += [
286  'pagelink-depth' => [
287  'type' => 'text',
288  'name' => 'pagelink-depth',
289  'id' => 'pagelink-depth',
290  'label-message' => 'export-pagelinks',
291  'default' => '0',
292  'size' => 20,
293  ],
294  ];
295  }
296 
297  $formDescriptor += [
298  'wpDownload' => [
299  'type' => 'check',
300  'name' => 'wpDownload',
301  'id' => 'wpDownload',
302  'default' => $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true,
303  'label-message' => 'export-download',
304  ],
305  ];
306 
307  if ( $config->get( 'ExportAllowListContributors' ) ) {
308  $formDescriptor += [
309  'listauthors' => [
310  'type' => 'check',
311  'label-message' => 'exportlistauthors',
312  'default' => $request->wasPosted() ? $request->getCheck( 'listauthors' ) : false,
313  'name' => 'listauthors',
314  'id' => 'listauthors',
315  ],
316  ];
317  }
318 
319  $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
320  $htmlForm->setSubmitTextMsg( 'export-submit' );
321  $htmlForm->prepareForm()->displayForm( false );
322  $this->addHelpLink( 'Help:Export' );
323  }
324 
328  private function userCanOverrideExportDepth() {
329  return $this->getUser()->isAllowed( 'override-export-depth' );
330  }
331 
341  private function doExport( $page, $history, $list_authors, $exportall ) {
342  // If we are grabbing everything, enable full history and ignore the rest
343  if ( $exportall ) {
344  $history = WikiExporter::FULL;
345  } else {
346  $pageSet = []; // Inverted index of all pages to look up
347 
348  // Split up and normalize input
349  foreach ( explode( "\n", $page ) as $pageName ) {
350  $pageName = trim( $pageName );
351  $title = Title::newFromText( $pageName );
352  if ( $title && !$title->isExternal() && $title->getText() !== '' ) {
353  // Only record each page once!
354  $pageSet[$title->getPrefixedText()] = true;
355  }
356  }
357 
358  // Set of original pages to pass on to further manipulation...
359  $inputPages = array_keys( $pageSet );
360 
361  // Look up any linked pages if asked...
362  if ( $this->templates ) {
363  $pageSet = $this->getTemplates( $inputPages, $pageSet );
364  }
365  $linkDepth = $this->pageLinkDepth;
366  if ( $linkDepth ) {
367  $pageSet = $this->getPageLinks( $inputPages, $pageSet, $linkDepth );
368  }
369 
370  $pages = array_keys( $pageSet );
371 
372  // Normalize titles to the same format and remove dupes, see T19374
373  foreach ( $pages as $k => $v ) {
374  $pages[$k] = str_replace( " ", "_", $v );
375  }
376 
377  $pages = array_unique( $pages );
378  }
379 
380  /* Ok, let's get to it... */
381  $db = wfGetDB( DB_REPLICA );
382 
383  $exporter = new WikiExporter( $db, $history );
384  $exporter->list_authors = $list_authors;
385  $exporter->openStream();
386 
387  if ( $exportall ) {
388  $exporter->allPages();
389  } else {
390  foreach ( $pages as $page ) {
391  # T10824: Only export pages the user can read
392  $title = Title::newFromText( $page );
393  if ( is_null( $title ) ) {
394  // @todo Perhaps output an <error> tag or something.
395  continue;
396  }
397 
398  if ( !$title->userCan( 'read', $this->getUser() ) ) {
399  // @todo Perhaps output an <error> tag or something.
400  continue;
401  }
402 
403  $exporter->pageByTitle( $title );
404  }
405  }
406 
407  $exporter->closeStream();
408  }
409 
414  private function getPagesFromCategory( $title ) {
415  $maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
416 
417  $name = $title->getDBkey();
418 
419  $dbr = wfGetDB( DB_REPLICA );
420  $res = $dbr->select(
421  [ 'page', 'categorylinks' ],
422  [ 'page_namespace', 'page_title' ],
423  [ 'cl_from=page_id', 'cl_to' => $name ],
424  __METHOD__,
425  [ 'LIMIT' => $maxPages ]
426  );
427 
428  $pages = [];
429 
430  foreach ( $res as $row ) {
431  $pages[] = Title::makeName( $row->page_namespace, $row->page_title );
432  }
433 
434  return $pages;
435  }
436 
441  private function getPagesFromNamespace( $nsindex ) {
442  $maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
443 
444  $dbr = wfGetDB( DB_REPLICA );
445  $res = $dbr->select(
446  'page',
447  [ 'page_namespace', 'page_title' ],
448  [ 'page_namespace' => $nsindex ],
449  __METHOD__,
450  [ 'LIMIT' => $maxPages ]
451  );
452 
453  $pages = [];
454 
455  foreach ( $res as $row ) {
456  $pages[] = Title::makeName( $row->page_namespace, $row->page_title );
457  }
458 
459  return $pages;
460  }
461 
468  private function getTemplates( $inputPages, $pageSet ) {
469  return $this->getLinks( $inputPages, $pageSet,
470  'templatelinks',
471  [ 'namespace' => 'tl_namespace', 'title' => 'tl_title' ],
472  [ 'page_id=tl_from' ]
473  );
474  }
475 
481  private function validateLinkDepth( $depth ) {
482  if ( $depth < 0 ) {
483  return 0;
484  }
485 
486  if ( !$this->userCanOverrideExportDepth() ) {
487  $maxLinkDepth = $this->getConfig()->get( 'ExportMaxLinkDepth' );
488  if ( $depth > $maxLinkDepth ) {
489  return $maxLinkDepth;
490  }
491  }
492 
493  /*
494  * There's a HARD CODED limit of 5 levels of recursion here to prevent a
495  * crazy-big export from being done by someone setting the depth
496  * number too high. In other words, last resort safety net.
497  */
498 
499  return intval( min( $depth, 5 ) );
500  }
501 
509  private function getPageLinks( $inputPages, $pageSet, $depth ) {
510  for ( ; $depth > 0; --$depth ) {
511  $pageSet = $this->getLinks(
512  $inputPages, $pageSet, 'pagelinks',
513  [ 'namespace' => 'pl_namespace', 'title' => 'pl_title' ],
514  [ 'page_id=pl_from' ]
515  );
516  $inputPages = array_keys( $pageSet );
517  }
518 
519  return $pageSet;
520  }
521 
531  private function getLinks( $inputPages, $pageSet, $table, $fields, $join ) {
532  $dbr = wfGetDB( DB_REPLICA );
533 
534  foreach ( $inputPages as $page ) {
535  $title = Title::newFromText( $page );
536 
537  if ( $title ) {
538  $pageSet[$title->getPrefixedText()] = true;
541  $result = $dbr->select(
542  [ 'page', $table ],
543  $fields,
544  array_merge(
545  $join,
546  [
547  'page_namespace' => $title->getNamespace(),
548  'page_title' => $title->getDBkey()
549  ]
550  ),
551  __METHOD__
552  );
553 
554  foreach ( $result as $row ) {
555  $template = Title::makeTitle( $row->namespace, $row->title );
556  $pageSet[$template->getPrefixedText()] = true;
557  }
558  }
559  }
560 
561  return $pageSet;
562  }
563 
564  protected function getGroupName() {
565  return 'pagetools';
566  }
567 }
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:306
SpecialExport\getLinks
getLinks( $inputPages, $pageSet, $table, $fields, $join)
Expand a list of pages to include items used in those pages.
Definition: SpecialExport.php:531
wfResetOutputBuffers
wfResetOutputBuffers( $resetGzipEncoding=true)
Clear away any user-level output buffers, discarding contents.
Definition: GlobalFunctions.php:1722
SpecialPage\msg
msg( $key)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:796
Title\makeName
static makeName( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false)
Make a prefixed DB key from a DB key and a namespace index.
Definition: Title.php:788
SpecialExport
A special page that allows users to export pages in a XML file.
Definition: SpecialExport.php:33
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:725
SpecialExport\execute
execute( $par)
Default execute method Checks user permissions.
Definition: SpecialExport.php:40
WikiExporter\CURRENT
const CURRENT
Definition: WikiExporter.php:50
SpecialExport\getTemplates
getTemplates( $inputPages, $pageSet)
Expand a list of pages to include templates used in those pages.
Definition: SpecialExport.php:468
$result
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. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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
Definition: hooks.txt:1991
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1912
$out
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:780
SpecialExport\doExport
doExport( $page, $history, $list_authors, $exportall)
Do the actual page exporting.
Definition: SpecialExport.php:341
$formDescriptor
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
Definition: hooks.txt:2072
$res
$res
Definition: database.txt:21
SpecialExport\$curonly
$curonly
Definition: SpecialExport.php:34
SpecialExport\$templates
$templates
Definition: SpecialExport.php:34
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$dbr
$dbr
Definition: testCompression.php:50
SpecialExport\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialExport.php:564
NS_MAIN
const NS_MAIN
Definition: Defines.php:64
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:832
SpecialExport\getPagesFromCategory
getPagesFromCategory( $title)
Definition: SpecialExport.php:414
SpecialExport\$doExport
$doExport
Definition: SpecialExport.php:34
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:764
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2636
HTMLForm\factory
static factory( $displayFormat)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:286
SpecialExport\getPageLinks
getPageLinks( $inputPages, $pageSet, $depth)
Expand a list of pages to include pages linked to from that page.
Definition: SpecialExport.php:509
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:531
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:735
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:576
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
wfTimestampNow
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
Definition: GlobalFunctions.php:1941
WikiExporter
Definition: WikiExporter.php:36
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:698
$request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2644
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
SpecialExport\$pageLinkDepth
$pageLinkDepth
Definition: SpecialExport.php:34
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:604
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:36
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:715
WikiExporter\FULL
const FULL
Definition: WikiExporter.php:49
SpecialExport\validateLinkDepth
validateLinkDepth( $depth)
Validate link depth setting, if available.
Definition: SpecialExport.php:481
SpecialExport\getPagesFromNamespace
getPagesFromNamespace( $nsindex)
Definition: SpecialExport.php:441
as
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
Definition: distributors.txt:9
LoggerFactory
MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method. MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances. The "Spi" in MediaWiki\Logger\Spi stands for "service provider interface". An SPI is an API intended to be implemented or extended by a third party. This software design pattern is intended to enable framework extension and replaceable components. It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki. The service provider interface allows the backend logging library to be implemented in multiple ways. The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime. This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance. Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory
Definition: logger.txt:5
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
$t
$t
Definition: testCompression.php:69
$template
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
Definition: hooks.txt:780
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:633
SpecialExport\userCanOverrideExportDepth
userCanOverrideExportDepth()
Definition: SpecialExport.php:328
SpecialExport\__construct
__construct()
Definition: SpecialExport.php:36