MediaWiki  1.23.15
SpecialImport.php
Go to the documentation of this file.
1 <?php
32 class SpecialImport extends SpecialPage {
33  private $interwiki = false;
34  private $namespace;
35  private $rootpage = '';
36  private $frompage = '';
37  private $logcomment = false;
38  private $history = true;
39  private $includeTemplates = false;
40  private $pageLinkDepth;
41 
45  public function __construct() {
46  parent::__construct( 'Import', 'import' );
47  global $wgImportTargetNamespace;
48  $this->namespace = $wgImportTargetNamespace;
49  }
50 
54  function execute( $par ) {
55  $this->setHeaders();
56  $this->outputHeader();
57 
58  $user = $this->getUser();
59  if ( !$user->isAllowedAny( 'import', 'importupload' ) ) {
60  throw new PermissionsError( 'import' );
61  }
62 
63  # @todo Allow Title::getUserPermissionsErrors() to take an array
64  # @todo FIXME: Title::checkSpecialsAndNSPermissions() has a very wierd expectation of what
65  # getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected'
66  $errors = wfMergeErrorArrays(
67  $this->getPageTitle()->getUserPermissionsErrors(
68  'import', $user, true,
69  array( 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' )
70  ),
71  $this->getPageTitle()->getUserPermissionsErrors(
72  'importupload', $user, true,
73  array( 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' )
74  )
75  );
76 
77  if ( $errors ) {
78  throw new PermissionsError( 'import', $errors );
79  }
80 
81  $this->checkReadOnly();
82 
83  $request = $this->getRequest();
84  if ( $request->wasPosted() && $request->getVal( 'action' ) == 'submit' ) {
85  $this->doImport();
86  }
87  $this->showForm();
88  }
89 
93  private function doImport() {
94  global $wgImportSources, $wgExportMaxLinkDepth;
95 
96  $isUpload = false;
97  $request = $this->getRequest();
98  $this->namespace = $request->getIntOrNull( 'namespace' );
99  $sourceName = $request->getVal( "source" );
100 
101  $this->logcomment = $request->getText( 'log-comment' );
102  $this->pageLinkDepth = $wgExportMaxLinkDepth == 0 ? 0 : $request->getIntOrNull( 'pagelink-depth' );
103  $this->rootpage = $request->getText( 'rootpage' );
104 
105  $user = $this->getUser();
106  if ( !$user->matchEditToken( $request->getVal( 'editToken' ) ) ) {
107  $source = Status::newFatal( 'import-token-mismatch' );
108  } elseif ( $sourceName == 'upload' ) {
109  $isUpload = true;
110  if ( $user->isAllowed( 'importupload' ) ) {
112  } else {
113  throw new PermissionsError( 'importupload' );
114  }
115  } elseif ( $sourceName == "interwiki" ) {
116  if ( !$user->isAllowed( 'import' ) ) {
117  throw new PermissionsError( 'import' );
118  }
119  $this->interwiki = $request->getVal( 'interwiki' );
120  if ( !in_array( $this->interwiki, $wgImportSources ) ) {
121  $source = Status::newFatal( "import-invalid-interwiki" );
122  } else {
123  $this->history = $request->getCheck( 'interwikiHistory' );
124  $this->frompage = $request->getText( "frompage" );
125  $this->includeTemplates = $request->getCheck( 'interwikiTemplates' );
127  $this->interwiki,
128  $this->frompage,
129  $this->history,
130  $this->includeTemplates,
131  $this->pageLinkDepth );
132  }
133  } else {
134  $source = Status::newFatal( "importunknownsource" );
135  }
136 
137  $out = $this->getOutput();
138  if ( !$source->isGood() ) {
139  $out->wrapWikiMsg(
140  "<p class=\"error\">\n$1\n</p>",
141  array( 'importfailed', $source->getWikiText() )
142  );
143  } else {
144  $importer = new WikiImporter( $source->value );
145  if ( !is_null( $this->namespace ) ) {
146  $importer->setTargetNamespace( $this->namespace );
147  }
148  if ( !is_null( $this->rootpage ) ) {
149  $statusRootPage = $importer->setTargetRootPage( $this->rootpage );
150  if ( !$statusRootPage->isGood() ) {
151  $out->wrapWikiMsg(
152  "<p class=\"error\">\n$1\n</p>",
153  array(
154  'import-options-wrong',
155  $statusRootPage->getWikiText(),
156  count( $statusRootPage->getErrorsArray() )
157  )
158  );
159 
160  return;
161  }
162  }
163 
164  $out->addWikiMsg( "importstart" );
165 
166  $reporter = new ImportReporter(
167  $importer,
168  $isUpload,
169  $this->interwiki,
170  $this->logcomment
171  );
172  $reporter->setContext( $this->getContext() );
173  $exception = false;
174 
175  $reporter->open();
176  try {
177  $importer->doImport();
178  } catch ( MWException $e ) {
179  $exception = $e;
180  }
181  $result = $reporter->close();
182 
183  if ( $exception ) {
184  # No source or XML parse error
185  $out->wrapWikiMsg(
186  "<p class=\"error\">\n$1\n</p>",
187  array( 'importfailed', $exception->getMessage() )
188  );
189  } elseif ( !$result->isGood() ) {
190  # Zero revisions
191  $out->wrapWikiMsg(
192  "<p class=\"error\">\n$1\n</p>",
193  array( 'importfailed', $result->getWikiText() )
194  );
195  } else {
196  # Success!
197  $out->addWikiMsg( 'importsuccess' );
198  }
199  $out->addHTML( '<hr />' );
200  }
201  }
202 
203  private function showForm() {
204  global $wgImportSources, $wgExportMaxLinkDepth;
205 
206  $action = $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) );
207  $user = $this->getUser();
208  $out = $this->getOutput();
209 
210  if ( $user->isAllowed( 'importupload' ) ) {
211  $out->addHTML(
212  Xml::fieldset( $this->msg( 'import-upload' )->text() ) .
214  'form',
215  array(
216  'enctype' => 'multipart/form-data',
217  'method' => 'post',
218  'action' => $action,
219  'id' => 'mw-import-upload-form'
220  )
221  ) .
222  $this->msg( 'importtext' )->parseAsBlock() .
223  Html::hidden( 'action', 'submit' ) .
224  Html::hidden( 'source', 'upload' ) .
225  Xml::openElement( 'table', array( 'id' => 'mw-import-table-upload' ) ) .
226  "<tr>
227  <td class='mw-label'>" .
228  Xml::label( $this->msg( 'import-upload-filename' )->text(), 'xmlimport' ) .
229  "</td>
230  <td class='mw-input'>" .
231  Html::input( 'xmlimport', '', 'file', array( 'id' => 'xmlimport' ) ) . ' ' .
232  "</td>
233  </tr>
234  <tr>
235  <td class='mw-label'>" .
236  Xml::label( $this->msg( 'import-comment' )->text(), 'mw-import-comment' ) .
237  "</td>
238  <td class='mw-input'>" .
239  Xml::input( 'log-comment', 50, '',
240  array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' .
241  "</td>
242  </tr>
243  <tr>
244  <td class='mw-label'>" .
245  Xml::label( $this->msg( 'import-interwiki-rootpage' )->text(), 'mw-interwiki-rootpage-upload' ) .
246  "</td>
247  <td class='mw-input'>" .
248  Xml::input( 'rootpage', 50, $this->rootpage,
249  array( 'id' => 'mw-interwiki-rootpage-upload', 'type' => 'text' ) ) . ' ' .
250  "</td>
251  </tr>
252  <tr>
253  <td></td>
254  <td class='mw-submit'>" .
255  Xml::submitButton( $this->msg( 'uploadbtn' )->text() ) .
256  "</td>
257  </tr>" .
258  Xml::closeElement( 'table' ) .
259  Html::hidden( 'editToken', $user->getEditToken() ) .
260  Xml::closeElement( 'form' ) .
261  Xml::closeElement( 'fieldset' )
262  );
263  } else {
264  if ( empty( $wgImportSources ) ) {
265  $out->addWikiMsg( 'importnosources' );
266  }
267  }
268 
269  if ( $user->isAllowed( 'import' ) && !empty( $wgImportSources ) ) {
270  # Show input field for import depth only if $wgExportMaxLinkDepth > 0
271  $importDepth = '';
272  if ( $wgExportMaxLinkDepth > 0 ) {
273  $importDepth = "<tr>
274  <td class='mw-label'>" .
275  $this->msg( 'export-pagelinks' )->parse() .
276  "</td>
277  <td class='mw-input'>" .
278  Xml::input( 'pagelink-depth', 3, 0 ) .
279  "</td>
280  </tr>";
281  }
282 
283  $out->addHTML(
284  Xml::fieldset( $this->msg( 'importinterwiki' )->text() ) .
286  'form',
287  array(
288  'method' => 'post',
289  'action' => $action,
290  'id' => 'mw-import-interwiki-form'
291  )
292  ) .
293  $this->msg( 'import-interwiki-text' )->parseAsBlock() .
294  Html::hidden( 'action', 'submit' ) .
295  Html::hidden( 'source', 'interwiki' ) .
296  Html::hidden( 'editToken', $user->getEditToken() ) .
297  Xml::openElement( 'table', array( 'id' => 'mw-import-table-interwiki' ) ) .
298  "<tr>
299  <td class='mw-label'>" .
300  Xml::label( $this->msg( 'import-interwiki-source' )->text(), 'interwiki' ) .
301  "</td>
302  <td class='mw-input'>" .
304  'select',
305  array( 'name' => 'interwiki', 'id' => 'interwiki' )
306  )
307  );
308 
309  foreach ( $wgImportSources as $prefix ) {
310  $selected = ( $this->interwiki === $prefix ) ? ' selected="selected"' : '';
311  $out->addHTML( Xml::option( $prefix, $prefix, $selected ) );
312  }
313 
314  $out->addHTML(
315  Xml::closeElement( 'select' ) .
316  Xml::input( 'frompage', 50, $this->frompage, array( 'id' => 'frompage' ) ) .
317  "</td>
318  </tr>
319  <tr>
320  <td>
321  </td>
322  <td class='mw-input'>" .
324  $this->msg( 'import-interwiki-history' )->text(),
325  'interwikiHistory',
326  'interwikiHistory',
327  $this->history
328  ) .
329  "</td>
330  </tr>
331  <tr>
332  <td>
333  </td>
334  <td class='mw-input'>" .
336  $this->msg( 'import-interwiki-templates' )->text(),
337  'interwikiTemplates',
338  'interwikiTemplates',
339  $this->includeTemplates
340  ) .
341  "</td>
342  </tr>
343  $importDepth
344  <tr>
345  <td class='mw-label'>" .
346  Xml::label( $this->msg( 'import-interwiki-namespace' )->text(), 'namespace' ) .
347  "</td>
348  <td class='mw-input'>" .
350  array(
351  'selected' => $this->namespace,
352  'all' => '',
353  ), array(
354  'name' => 'namespace',
355  'id' => 'namespace',
356  'class' => 'namespaceselector',
357  )
358  ) .
359  "</td>
360  </tr>
361  <tr>
362  <td class='mw-label'>" .
363  Xml::label( $this->msg( 'import-comment' )->text(), 'mw-interwiki-comment' ) .
364  "</td>
365  <td class='mw-input'>" .
366  Xml::input( 'log-comment', 50, '',
367  array( 'id' => 'mw-interwiki-comment', 'type' => 'text' ) ) . ' ' .
368  "</td>
369  </tr>
370  <tr>
371  <td class='mw-label'>" .
372  Xml::label(
373  $this->msg( 'import-interwiki-rootpage' )->text(),
374  'mw-interwiki-rootpage-interwiki'
375  ) .
376  "</td>
377  <td class='mw-input'>" .
378  Xml::input( 'rootpage', 50, $this->rootpage,
379  array( 'id' => 'mw-interwiki-rootpage-interwiki', 'type' => 'text' ) ) . ' ' .
380  "</td>
381  </tr>
382  <tr>
383  <td>
384  </td>
385  <td class='mw-submit'>" .
387  $this->msg( 'import-interwiki-submit' )->text(),
389  ) .
390  "</td>
391  </tr>" .
392  Xml::closeElement( 'table' ) .
393  Xml::closeElement( 'form' ) .
394  Xml::closeElement( 'fieldset' )
395  );
396  }
397  }
398 
399  protected function getGroupName() {
400  return 'pagetools';
401  }
402 }
403 
409  private $reason = false;
410  private $mOriginalLogCallback = null;
412  private $mLogItemCount = 0;
413 
420  function __construct( $importer, $upload, $interwiki, $reason = false ) {
421  $this->mOriginalPageOutCallback =
422  $importer->setPageOutCallback( array( $this, 'reportPage' ) );
423  $this->mOriginalLogCallback =
424  $importer->setLogItemCallback( array( $this, 'reportLogItem' ) );
425  $importer->setNoticeCallback( array( $this, 'reportNotice' ) );
426  $this->mPageCount = 0;
427  $this->mIsUpload = $upload;
428  $this->mInterwiki = $interwiki;
429  $this->reason = $reason;
430  }
431 
432  function open() {
433  $this->getOutput()->addHTML( "<ul>\n" );
434  }
435 
436  function reportNotice( $msg, array $params ) {
437  $this->getOutput()->addHTML( Html::element( 'li', array(), $this->msg( $msg, $params )->text() ) );
438  }
439 
440  function reportLogItem( /* ... */ ) {
441  $this->mLogItemCount++;
442  if ( is_callable( $this->mOriginalLogCallback ) ) {
443  call_user_func_array( $this->mOriginalLogCallback, func_get_args() );
444  }
445  }
446 
455  function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
456  $args = func_get_args();
457  call_user_func_array( $this->mOriginalPageOutCallback, $args );
458 
459  if ( $title === null ) {
460  # Invalid or non-importable title; a notice is already displayed
461  return;
462  }
463 
464  $this->mPageCount++;
465 
466  if ( $successCount > 0 ) {
467  $this->getOutput()->addHTML(
468  "<li>" . Linker::linkKnown( $title ) . " " .
469  $this->msg( 'import-revision-count' )->numParams( $successCount )->escaped() .
470  "</li>\n"
471  );
472 
473  $log = new LogPage( 'import' );
474  if ( $this->mIsUpload ) {
475  $detail = $this->msg( 'import-logentry-upload-detail' )->numParams(
476  $successCount )->inContentLanguage()->text();
477  if ( $this->reason ) {
478  $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $this->reason;
479  }
480  $log->addEntry( 'upload', $title, $detail, array(), $this->getUser() );
481  } else {
482  $interwiki = '[[:' . $this->mInterwiki . ':' .
483  $origTitle->getPrefixedText() . ']]';
484  $detail = $this->msg( 'import-logentry-interwiki-detail' )->numParams(
485  $successCount )->params( $interwiki )->inContentLanguage()->text();
486  if ( $this->reason ) {
487  $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $this->reason;
488  }
489  $log->addEntry( 'interwiki', $title, $detail, array(), $this->getUser() );
490  }
491 
492  $comment = $detail; // quick
493  $dbw = wfGetDB( DB_MASTER );
494  $latest = $title->getLatestRevID();
495  $nullRevision = Revision::newNullRevision( $dbw, $title->getArticleID(), $comment, true );
496  if ( !is_null( $nullRevision ) ) {
497  $nullRevision->insertOn( $dbw );
498  $page = WikiPage::factory( $title );
499  # Update page record
500  $page->updateRevisionOn( $dbw, $nullRevision );
501  wfRunHooks( 'NewRevisionFromEditComplete', array( $page, $nullRevision, $latest, $this->getUser() ) );
502  }
503  } else {
504  $this->getOutput()->addHTML( "<li>" . Linker::linkKnown( $title ) . " " .
505  $this->msg( 'import-nonewrevisions' )->escaped() . "</li>\n" );
506  }
507  }
508 
509  function close() {
510  $out = $this->getOutput();
511  if ( $this->mLogItemCount > 0 ) {
512  $msg = $this->msg( 'imported-log-entries' )->numParams( $this->mLogItemCount )->parse();
513  $out->addHTML( Xml::tags( 'li', null, $msg ) );
514  } elseif ( $this->mPageCount == 0 && $this->mLogItemCount == 0 ) {
515  $out->addHTML( "</ul>\n" );
516 
517  return Status::newFatal( 'importnopages' );
518  }
519  $out->addHTML( "</ul>\n" );
520 
521  return Status::newGood( $this->mPageCount );
522  }
523 }
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:433
SpecialImport\showForm
showForm()
Definition: SpecialImport.php:203
SpecialImport
MediaWiki page data importer.
Definition: SpecialImport.php:32
SpecialImport\$pageLinkDepth
$pageLinkDepth
Definition: SpecialImport.php:40
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:488
SpecialImport\$includeTemplates
$includeTemplates
Definition: SpecialImport.php:39
WikiImporter
XML file reader for the page data importer.
Definition: Import.php:33
$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. '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
Definition: hooks.txt:1528
ImportReporter\reportPage
reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo)
Definition: SpecialImport.php:455
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
$request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success you ll probably need to make sure the header is varied on WebRequest $request
Definition: hooks.txt:1961
wfMergeErrorArrays
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
Definition: GlobalFunctions.php:260
php
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
Definition: skin.txt:62
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:175
Revision\newNullRevision
static newNullRevision( $dbw, $pageId, $summary, $minor)
Create a new null-revision for insertion into a page's history.
Definition: Revision.php:1567
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:535
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3714
text
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
Definition: design.txt:12
ImportReporter\$mOriginalPageOutCallback
$mOriginalPageOutCallback
Definition: SpecialImport.php:411
Xml\option
static option( $text, $value=null, $selected=false, $attribs=array())
Convenience function to build an HTML drop-down list item.
Definition: Xml.php:475
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
$params
$params
Definition: styleTest.css.php:40
Html\hidden
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Definition: Html.php:607
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
ImportReporter
Reporting callback.
Definition: SpecialImport.php:408
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
SpecialImport\$namespace
$namespace
Definition: SpecialImport.php:34
true
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
Definition: hooks.txt:1530
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2307
SpecialImport\execute
execute( $par)
Execute.
Definition: SpecialImport.php:54
SpecialImport\doImport
doImport()
Do the actual import.
Definition: SpecialImport.php:93
MWException
MediaWiki exception.
Definition: MWException.php:26
$out
$out
Definition: UtfNormalGenerate.php:167
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:103
ImportReporter\reportLogItem
reportLogItem()
Definition: SpecialImport.php:440
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:141
ContextSource\getOutput
getOutput()
Get the OutputPage object.
Definition: ContextSource.php:122
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:32
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4066
SpecialImport\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialImport.php:399
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ImportReporter\__construct
__construct( $importer, $upload, $interwiki, $reason=false)
Definition: SpecialImport.php:420
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:352
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:545
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
$comment
$comment
Definition: importImages.php:107
Html\input
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
Definition: Html.php:590
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:508
ImportStreamSource\newFromInterwiki
static newFromInterwiki( $interwiki, $page, $history=false, $templates=false, $pageLinkDepth=0)
Definition: Import.php:1726
SpecialImport\$interwiki
$interwiki
Definition: SpecialImport.php:33
ImportReporter\$mOriginalLogCallback
$mOriginalLogCallback
Definition: SpecialImport.php:410
SpecialImport\$frompage
$frompage
Definition: SpecialImport.php:36
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
ImportReporter\reportNotice
reportNotice( $msg, array $params)
Definition: SpecialImport.php:436
SpecialPage\msg
msg()
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:609
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:33
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:525
$upload
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 where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object $upload
Definition: hooks.txt:2584
SpecialImport\$logcomment
$logcomment
Definition: SpecialImport.php:37
ImportReporter\close
close()
Definition: SpecialImport.php:509
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
ImportReporter\$reason
$reason
Definition: SpecialImport.php:409
ImportReporter\$mLogItemCount
$mLogItemCount
Definition: SpecialImport.php:412
$args
if( $line===false) $args
Definition: cdb.php:62
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:118
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
Html\namespaceSelector
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
Definition: Html.php:652
SpecialImport\__construct
__construct()
Constructor.
Definition: SpecialImport.php:45
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
Xml\submitButton
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
Definition: Xml.php:463
ImportReporter\open
open()
Definition: SpecialImport.php:432
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:300
Xml\input
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
Definition: Xml.php:294
SpecialImport\$rootpage
$rootpage
Definition: SpecialImport.php:35
SpecialImport\$history
$history
Definition: SpecialImport.php:38
Xml\label
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
Definition: Xml.php:374
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:443
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
Definition: Xml.php:563
ImportStreamSource\newFromUpload
static newFromUpload( $fieldname="xmlimport")
Definition: Import.php:1667
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:1632
Status\newFatal
static newFatal( $message)
Factory function for fatal errors.
Definition: Status.php:63