MediaWiki  1.23.12
Import.php
Go to the documentation of this file.
1 <?php
33 class WikiImporter {
34  private $reader = null;
39  private $mNoUpdates = false;
40 
45  function __construct( $source ) {
46  $this->reader = new XMLReader();
47 
48  stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' );
50  if ( defined( 'LIBXML_PARSEHUGE' ) ) {
51  $this->reader->open( "uploadsource://$id", null, LIBXML_PARSEHUGE );
52  } else {
53  $this->reader->open( "uploadsource://$id" );
54  }
55 
56  // Default callbacks
57  $this->setRevisionCallback( array( $this, "importRevision" ) );
58  $this->setUploadCallback( array( $this, 'importUpload' ) );
59  $this->setLogItemCallback( array( $this, 'importLogItem' ) );
60  $this->setPageOutCallback( array( $this, 'finishImportPage' ) );
61  }
62 
63  private function throwXmlError( $err ) {
64  $this->debug( "FAILURE: $err" );
65  wfDebug( "WikiImporter XML error: $err\n" );
66  }
67 
68  private function debug( $data ) {
69  if ( $this->mDebug ) {
70  wfDebug( "IMPORT: $data\n" );
71  }
72  }
73 
74  private function warn( $data ) {
75  wfDebug( "IMPORT: $data\n" );
76  }
77 
78  private function notice( $msg /*, $param, ...*/ ) {
79  $params = func_get_args();
80  array_shift( $params );
81 
82  if ( is_callable( $this->mNoticeCallback ) ) {
83  call_user_func( $this->mNoticeCallback, $msg, $params );
84  } else { # No ImportReporter -> CLI
85  echo wfMessage( $msg, $params )->text() . "\n";
86  }
87  }
88 
93  function setDebug( $debug ) {
94  $this->mDebug = $debug;
95  }
96 
101  function setNoUpdates( $noupdates ) {
102  $this->mNoUpdates = $noupdates;
103  }
104 
111  public function setNoticeCallback( $callback ) {
112  return wfSetVar( $this->mNoticeCallback, $callback );
113  }
114 
120  public function setPageCallback( $callback ) {
121  $previous = $this->mPageCallback;
122  $this->mPageCallback = $callback;
123  return $previous;
124  }
125 
135  public function setPageOutCallback( $callback ) {
136  $previous = $this->mPageOutCallback;
137  $this->mPageOutCallback = $callback;
138  return $previous;
139  }
140 
146  public function setRevisionCallback( $callback ) {
147  $previous = $this->mRevisionCallback;
148  $this->mRevisionCallback = $callback;
149  return $previous;
150  }
151 
157  public function setUploadCallback( $callback ) {
158  $previous = $this->mUploadCallback;
159  $this->mUploadCallback = $callback;
160  return $previous;
161  }
162 
168  public function setLogItemCallback( $callback ) {
169  $previous = $this->mLogItemCallback;
170  $this->mLogItemCallback = $callback;
171  return $previous;
172  }
173 
179  public function setSiteInfoCallback( $callback ) {
180  $previous = $this->mSiteInfoCallback;
181  $this->mSiteInfoCallback = $callback;
182  return $previous;
183  }
184 
190  public function setTargetNamespace( $namespace ) {
191  if ( is_null( $namespace ) ) {
192  // Don't override namespaces
193  $this->mTargetNamespace = null;
194  } elseif ( $namespace >= 0 ) {
195  // @todo FIXME: Check for validity
196  $this->mTargetNamespace = intval( $namespace );
197  } else {
198  return false;
199  }
200  }
201 
207  public function setTargetRootPage( $rootpage ) {
208  $status = Status::newGood();
209  if ( is_null( $rootpage ) ) {
210  // No rootpage
211  $this->mTargetRootPage = null;
212  } elseif ( $rootpage !== '' ) {
213  $rootpage = rtrim( $rootpage, '/' ); //avoid double slashes
214  $title = Title::newFromText( $rootpage, !is_null( $this->mTargetNamespace ) ? $this->mTargetNamespace : NS_MAIN );
215  if ( !$title || $title->isExternal() ) {
216  $status->fatal( 'import-rootpage-invalid' );
217  } else {
218  if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
220 
221  $displayNSText = $title->getNamespace() == NS_MAIN
222  ? wfMessage( 'blanknamespace' )->text()
223  : $wgContLang->getNsText( $title->getNamespace() );
224  $status->fatal( 'import-rootpage-nosubpage', $displayNSText );
225  } else {
226  // set namespace to 'all', so the namespace check in processTitle() can passed
227  $this->setTargetNamespace( null );
228  $this->mTargetRootPage = $title->getPrefixedDBkey();
229  }
230  }
231  }
232  return $status;
233  }
234 
238  public function setImageBasePath( $dir ) {
239  $this->mImageBasePath = $dir;
240  }
241 
245  public function setImportUploads( $import ) {
246  $this->mImportUploads = $import;
247  }
248 
254  public function importRevision( $revision ) {
255  if ( !$revision->getContent()->getContentHandler()->canBeUsedOn( $revision->getTitle() ) ) {
256  $this->notice( 'import-error-bad-location',
257  $revision->getTitle()->getPrefixedText(),
258  $revision->getID(),
259  $revision->getModel(),
260  $revision->getFormat() );
261 
262  return false;
263  }
264 
265  try {
266  $dbw = wfGetDB( DB_MASTER );
267  return $dbw->deadlockLoop( array( $revision, 'importOldRevision' ) );
268  } catch ( MWContentSerializationException $ex ) {
269  $this->notice( 'import-error-unserialize',
270  $revision->getTitle()->getPrefixedText(),
271  $revision->getID(),
272  $revision->getModel(),
273  $revision->getFormat() );
274  }
275 
276  return false;
277  }
278 
284  public function importLogItem( $rev ) {
285  $dbw = wfGetDB( DB_MASTER );
286  return $dbw->deadlockLoop( array( $rev, 'importLogItem' ) );
287  }
288 
294  public function importUpload( $revision ) {
295  $dbw = wfGetDB( DB_MASTER );
296  return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
297  }
298 
308  public function finishImportPage( $title, $origTitle, $revCount, $sRevCount, $pageInfo ) {
309  $args = func_get_args();
310  return wfRunHooks( 'AfterImportPage', $args );
311  }
312 
317  public function debugRevisionHandler( &$revision ) {
318  $this->debug( "Got revision:" );
319  if ( is_object( $revision->title ) ) {
320  $this->debug( "-- Title: " . $revision->title->getPrefixedText() );
321  } else {
322  $this->debug( "-- Title: <invalid>" );
323  }
324  $this->debug( "-- User: " . $revision->user_text );
325  $this->debug( "-- Timestamp: " . $revision->timestamp );
326  $this->debug( "-- Comment: " . $revision->comment );
327  $this->debug( "-- Text: " . $revision->text );
328  }
329 
334  function pageCallback( $title ) {
335  if ( isset( $this->mPageCallback ) ) {
336  call_user_func( $this->mPageCallback, $title );
337  }
338  }
339 
348  private function pageOutCallback( $title, $origTitle, $revCount, $sucCount, $pageInfo ) {
349  if ( isset( $this->mPageOutCallback ) ) {
350  $args = func_get_args();
351  call_user_func_array( $this->mPageOutCallback, $args );
352  }
353  }
354 
360  private function revisionCallback( $revision ) {
361  if ( isset( $this->mRevisionCallback ) ) {
362  return call_user_func_array( $this->mRevisionCallback,
363  array( $revision, $this ) );
364  } else {
365  return false;
366  }
367  }
368 
374  private function logItemCallback( $revision ) {
375  if ( isset( $this->mLogItemCallback ) ) {
376  return call_user_func_array( $this->mLogItemCallback,
377  array( $revision, $this ) );
378  } else {
379  return false;
380  }
381  }
382 
390  private function nodeContents() {
391  if ( $this->reader->isEmptyElement ) {
392  return "";
393  }
394  $buffer = "";
395  while ( $this->reader->read() ) {
396  switch ( $this->reader->nodeType ) {
397  case XmlReader::TEXT:
398  case XmlReader::SIGNIFICANT_WHITESPACE:
399  $buffer .= $this->reader->value;
400  break;
401  case XmlReader::END_ELEMENT:
402  return $buffer;
403  }
404  }
405 
406  $this->reader->close();
407  return '';
408  }
409 
410  # --------------
411 
413  private function dumpElement() {
414  static $lookup = null;
415  if ( !$lookup ) {
416  $xmlReaderConstants = array(
417  "NONE",
418  "ELEMENT",
419  "ATTRIBUTE",
420  "TEXT",
421  "CDATA",
422  "ENTITY_REF",
423  "ENTITY",
424  "PI",
425  "COMMENT",
426  "DOC",
427  "DOC_TYPE",
428  "DOC_FRAGMENT",
429  "NOTATION",
430  "WHITESPACE",
431  "SIGNIFICANT_WHITESPACE",
432  "END_ELEMENT",
433  "END_ENTITY",
434  "XML_DECLARATION",
435  );
436  $lookup = array();
437 
438  foreach ( $xmlReaderConstants as $name ) {
439  $lookup[constant( "XmlReader::$name" )] = $name;
440  }
441  }
442 
443  print var_dump(
444  $lookup[$this->reader->nodeType],
445  $this->reader->name,
446  $this->reader->value
447  ) . "\n\n";
448  }
449 
455  public function doImport() {
456 
457  // Calls to reader->read need to be wrapped in calls to
458  // libxml_disable_entity_loader() to avoid local file
459  // inclusion attacks (bug 46932).
460  $oldDisable = libxml_disable_entity_loader( true );
461  $this->reader->read();
462 
463  if ( $this->reader->name != 'mediawiki' ) {
464  libxml_disable_entity_loader( $oldDisable );
465  throw new MWException( "Expected <mediawiki> tag, got " .
466  $this->reader->name );
467  }
468  $this->debug( "<mediawiki> tag is correct." );
469 
470  $this->debug( "Starting primary dump processing loop." );
471 
472  $keepReading = $this->reader->read();
473  $skip = false;
474  while ( $keepReading ) {
475  $tag = $this->reader->name;
476  $type = $this->reader->nodeType;
477 
478  if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', array( $this ) ) ) {
479  // Do nothing
480  } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) {
481  break;
482  } elseif ( $tag == 'siteinfo' ) {
483  $this->handleSiteInfo();
484  } elseif ( $tag == 'page' ) {
485  $this->handlePage();
486  } elseif ( $tag == 'logitem' ) {
487  $this->handleLogItem();
488  } elseif ( $tag != '#text' ) {
489  $this->warn( "Unhandled top-level XML tag $tag" );
490 
491  $skip = true;
492  }
493 
494  if ( $skip ) {
495  $keepReading = $this->reader->next();
496  $skip = false;
497  $this->debug( "Skip" );
498  } else {
499  $keepReading = $this->reader->read();
500  }
501  }
502 
503  libxml_disable_entity_loader( $oldDisable );
504  return true;
505  }
506 
511  private function handleSiteInfo() {
512  // Site info is useful, but not actually used for dump imports.
513  // Includes a quick short-circuit to save performance.
514  if ( ! $this->mSiteInfoCallback ) {
515  $this->reader->next();
516  return true;
517  }
518  throw new MWException( "SiteInfo tag is not yet handled, do not set mSiteInfoCallback" );
519  }
520 
521  private function handleLogItem() {
522  $this->debug( "Enter log item handler." );
523  $logInfo = array();
524 
525  // Fields that can just be stuffed in the pageInfo object
526  $normalFields = array( 'id', 'comment', 'type', 'action', 'timestamp',
527  'logtitle', 'params' );
528 
529  while ( $this->reader->read() ) {
530  if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
531  $this->reader->name == 'logitem' ) {
532  break;
533  }
534 
535  $tag = $this->reader->name;
536 
537  if ( !wfRunHooks( 'ImportHandleLogItemXMLTag', array(
538  $this, $logInfo
539  ) ) ) {
540  // Do nothing
541  } elseif ( in_array( $tag, $normalFields ) ) {
542  $logInfo[$tag] = $this->nodeContents();
543  } elseif ( $tag == 'contributor' ) {
544  $logInfo['contributor'] = $this->handleContributor();
545  } elseif ( $tag != '#text' ) {
546  $this->warn( "Unhandled log-item XML tag $tag" );
547  }
548  }
549 
550  $this->processLogItem( $logInfo );
551  }
552 
557  private function processLogItem( $logInfo ) {
558  $revision = new WikiRevision;
559 
560  $revision->setID( $logInfo['id'] );
561  $revision->setType( $logInfo['type'] );
562  $revision->setAction( $logInfo['action'] );
563  $revision->setTimestamp( $logInfo['timestamp'] );
564  $revision->setParams( $logInfo['params'] );
565  $revision->setTitle( Title::newFromText( $logInfo['logtitle'] ) );
566  $revision->setNoUpdates( $this->mNoUpdates );
567 
568  if ( isset( $logInfo['comment'] ) ) {
569  $revision->setComment( $logInfo['comment'] );
570  }
571 
572  if ( isset( $logInfo['contributor']['ip'] ) ) {
573  $revision->setUserIP( $logInfo['contributor']['ip'] );
574  }
575  if ( isset( $logInfo['contributor']['username'] ) ) {
576  $revision->setUserName( $logInfo['contributor']['username'] );
577  }
578 
579  return $this->logItemCallback( $revision );
580  }
581 
582  private function handlePage() {
583  // Handle page data.
584  $this->debug( "Enter page handler." );
585  $pageInfo = array( 'revisionCount' => 0, 'successfulRevisionCount' => 0 );
586 
587  // Fields that can just be stuffed in the pageInfo object
588  $normalFields = array( 'title', 'id', 'redirect', 'restrictions' );
589 
590  $skip = false;
591  $badTitle = false;
592 
593  while ( $skip ? $this->reader->next() : $this->reader->read() ) {
594  if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
595  $this->reader->name == 'page' ) {
596  break;
597  }
598 
599  $tag = $this->reader->name;
600 
601  if ( $badTitle ) {
602  // The title is invalid, bail out of this page
603  $skip = true;
604  } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this,
605  &$pageInfo ) ) ) {
606  // Do nothing
607  } elseif ( in_array( $tag, $normalFields ) ) {
608  $pageInfo[$tag] = $this->nodeContents();
609  if ( $tag == 'title' ) {
610  $title = $this->processTitle( $pageInfo['title'] );
611 
612  if ( !$title ) {
613  $badTitle = true;
614  $skip = true;
615  }
616 
617  $this->pageCallback( $title );
618  list( $pageInfo['_title'], $origTitle ) = $title;
619  }
620  } elseif ( $tag == 'revision' ) {
621  $this->handleRevision( $pageInfo );
622  } elseif ( $tag == 'upload' ) {
623  $this->handleUpload( $pageInfo );
624  } elseif ( $tag != '#text' ) {
625  $this->warn( "Unhandled page XML tag $tag" );
626  $skip = true;
627  }
628  }
629 
630  $this->pageOutCallback( $pageInfo['_title'], $origTitle,
631  $pageInfo['revisionCount'],
632  $pageInfo['successfulRevisionCount'],
633  $pageInfo );
634  }
635 
639  private function handleRevision( &$pageInfo ) {
640  $this->debug( "Enter revision handler" );
641  $revisionInfo = array();
642 
643  $normalFields = array( 'id', 'timestamp', 'comment', 'minor', 'model', 'format', 'text' );
644 
645  $skip = false;
646 
647  while ( $skip ? $this->reader->next() : $this->reader->read() ) {
648  if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
649  $this->reader->name == 'revision' ) {
650  break;
651  }
652 
653  $tag = $this->reader->name;
654 
655  if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', array(
656  $this, $pageInfo, $revisionInfo
657  ) ) ) {
658  // Do nothing
659  } elseif ( in_array( $tag, $normalFields ) ) {
660  $revisionInfo[$tag] = $this->nodeContents();
661  } elseif ( $tag == 'contributor' ) {
662  $revisionInfo['contributor'] = $this->handleContributor();
663  } elseif ( $tag != '#text' ) {
664  $this->warn( "Unhandled revision XML tag $tag" );
665  $skip = true;
666  }
667  }
668 
669  $pageInfo['revisionCount']++;
670  if ( $this->processRevision( $pageInfo, $revisionInfo ) ) {
671  $pageInfo['successfulRevisionCount']++;
672  }
673  }
674 
680  private function processRevision( $pageInfo, $revisionInfo ) {
681  $revision = new WikiRevision;
682 
683  if ( isset( $revisionInfo['id'] ) ) {
684  $revision->setID( $revisionInfo['id'] );
685  }
686  if ( isset( $revisionInfo['text'] ) ) {
687  $revision->setText( $revisionInfo['text'] );
688  }
689  if ( isset( $revisionInfo['model'] ) ) {
690  $revision->setModel( $revisionInfo['model'] );
691  }
692  if ( isset( $revisionInfo['format'] ) ) {
693  $revision->setFormat( $revisionInfo['format'] );
694  }
695  $revision->setTitle( $pageInfo['_title'] );
696 
697  if ( isset( $revisionInfo['timestamp'] ) ) {
698  $revision->setTimestamp( $revisionInfo['timestamp'] );
699  } else {
700  $revision->setTimestamp( wfTimestampNow() );
701  }
702 
703  if ( isset( $revisionInfo['comment'] ) ) {
704  $revision->setComment( $revisionInfo['comment'] );
705  }
706 
707  if ( isset( $revisionInfo['minor'] ) ) {
708  $revision->setMinor( true );
709  }
710  if ( isset( $revisionInfo['contributor']['ip'] ) ) {
711  $revision->setUserIP( $revisionInfo['contributor']['ip'] );
712  }
713  if ( isset( $revisionInfo['contributor']['username'] ) ) {
714  $revision->setUserName( $revisionInfo['contributor']['username'] );
715  }
716  $revision->setNoUpdates( $this->mNoUpdates );
717 
718  return $this->revisionCallback( $revision );
719  }
720 
725  private function handleUpload( &$pageInfo ) {
726  $this->debug( "Enter upload handler" );
727  $uploadInfo = array();
728 
729  $normalFields = array( 'timestamp', 'comment', 'filename', 'text',
730  'src', 'size', 'sha1base36', 'archivename', 'rel' );
731 
732  $skip = false;
733 
734  while ( $skip ? $this->reader->next() : $this->reader->read() ) {
735  if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
736  $this->reader->name == 'upload' ) {
737  break;
738  }
739 
740  $tag = $this->reader->name;
741 
742  if ( !wfRunHooks( 'ImportHandleUploadXMLTag', array(
743  $this, $pageInfo
744  ) ) ) {
745  // Do nothing
746  } elseif ( in_array( $tag, $normalFields ) ) {
747  $uploadInfo[$tag] = $this->nodeContents();
748  } elseif ( $tag == 'contributor' ) {
749  $uploadInfo['contributor'] = $this->handleContributor();
750  } elseif ( $tag == 'contents' ) {
751  $contents = $this->nodeContents();
752  $encoding = $this->reader->getAttribute( 'encoding' );
753  if ( $encoding === 'base64' ) {
754  $uploadInfo['fileSrc'] = $this->dumpTemp( base64_decode( $contents ) );
755  $uploadInfo['isTempSrc'] = true;
756  }
757  } elseif ( $tag != '#text' ) {
758  $this->warn( "Unhandled upload XML tag $tag" );
759  $skip = true;
760  }
761  }
762 
763  if ( $this->mImageBasePath && isset( $uploadInfo['rel'] ) ) {
764  $path = "{$this->mImageBasePath}/{$uploadInfo['rel']}";
765  if ( file_exists( $path ) ) {
766  $uploadInfo['fileSrc'] = $path;
767  $uploadInfo['isTempSrc'] = false;
768  }
769  }
770 
771  if ( $this->mImportUploads ) {
772  return $this->processUpload( $pageInfo, $uploadInfo );
773  }
774  }
775 
780  private function dumpTemp( $contents ) {
781  $filename = tempnam( wfTempDir(), 'importupload' );
782  file_put_contents( $filename, $contents );
783  return $filename;
784  }
785 
791  private function processUpload( $pageInfo, $uploadInfo ) {
792  $revision = new WikiRevision;
793  $text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
794 
795  $revision->setTitle( $pageInfo['_title'] );
796  $revision->setID( $pageInfo['id'] );
797  $revision->setTimestamp( $uploadInfo['timestamp'] );
798  $revision->setText( $text );
799  $revision->setFilename( $uploadInfo['filename'] );
800  if ( isset( $uploadInfo['archivename'] ) ) {
801  $revision->setArchiveName( $uploadInfo['archivename'] );
802  }
803  $revision->setSrc( $uploadInfo['src'] );
804  if ( isset( $uploadInfo['fileSrc'] ) ) {
805  $revision->setFileSrc( $uploadInfo['fileSrc'],
806  !empty( $uploadInfo['isTempSrc'] ) );
807  }
808  if ( isset( $uploadInfo['sha1base36'] ) ) {
809  $revision->setSha1Base36( $uploadInfo['sha1base36'] );
810  }
811  $revision->setSize( intval( $uploadInfo['size'] ) );
812  $revision->setComment( $uploadInfo['comment'] );
813 
814  if ( isset( $uploadInfo['contributor']['ip'] ) ) {
815  $revision->setUserIP( $uploadInfo['contributor']['ip'] );
816  }
817  if ( isset( $uploadInfo['contributor']['username'] ) ) {
818  $revision->setUserName( $uploadInfo['contributor']['username'] );
819  }
820  $revision->setNoUpdates( $this->mNoUpdates );
821 
822  return call_user_func( $this->mUploadCallback, $revision );
823  }
824 
828  private function handleContributor() {
829  $fields = array( 'id', 'ip', 'username' );
830  $info = array();
831 
832  while ( $this->reader->read() ) {
833  if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
834  $this->reader->name == 'contributor' ) {
835  break;
836  }
837 
838  $tag = $this->reader->name;
839 
840  if ( in_array( $tag, $fields ) ) {
841  $info[$tag] = $this->nodeContents();
842  }
843  }
844 
845  return $info;
846  }
847 
852  private function processTitle( $text ) {
854 
855  $workTitle = $text;
856  $origTitle = Title::newFromText( $workTitle );
857 
858  if ( !is_null( $this->mTargetNamespace ) && !is_null( $origTitle ) ) {
859  # makeTitleSafe, because $origTitle can have a interwiki (different setting of interwiki map)
860  # and than dbKey can begin with a lowercase char
861  $title = Title::makeTitleSafe( $this->mTargetNamespace,
862  $origTitle->getDBkey() );
863  } else {
864  if ( !is_null( $this->mTargetRootPage ) ) {
865  $workTitle = $this->mTargetRootPage . '/' . $workTitle;
866  }
867  $title = Title::newFromText( $workTitle );
868  }
869 
870  if ( is_null( $title ) ) {
871  # Invalid page title? Ignore the page
872  $this->notice( 'import-error-invalid', $workTitle );
873  return false;
874  } elseif ( $title->isExternal() ) {
875  $this->notice( 'import-error-interwiki', $title->getPrefixedText() );
876  return false;
877  } elseif ( !$title->canExist() ) {
878  $this->notice( 'import-error-special', $title->getPrefixedText() );
879  return false;
880  } elseif ( !$title->userCan( 'edit' ) && !$wgCommandLineMode ) {
881  # Do not import if the importing wiki user cannot edit this page
882  $this->notice( 'import-error-edit', $title->getPrefixedText() );
883  return false;
884  } elseif ( !$title->exists() && !$title->userCan( 'create' ) && !$wgCommandLineMode ) {
885  # Do not import if the importing wiki user cannot create this page
886  $this->notice( 'import-error-create', $title->getPrefixedText() );
887  return false;
888  }
889 
890  return array( $title, $origTitle );
891  }
892 }
893 
897 
898  private $mSource;
899  private $mBuffer;
900  private $mPosition;
901 
906  static function registerSource( $source ) {
907  $id = wfRandomString();
908 
909  self::$sourceRegistrations[$id] = $source;
910 
911  return $id;
912  }
913 
921  function stream_open( $path, $mode, $options, &$opened_path ) {
922  $url = parse_url( $path );
923  $id = $url['host'];
924 
925  if ( !isset( self::$sourceRegistrations[$id] ) ) {
926  return false;
927  }
928 
929  $this->mSource = self::$sourceRegistrations[$id];
930 
931  return true;
932  }
933 
938  function stream_read( $count ) {
939  $return = '';
940  $leave = false;
941 
942  while ( !$leave && !$this->mSource->atEnd() &&
943  strlen( $this->mBuffer ) < $count ) {
944  $read = $this->mSource->readChunk();
945 
946  if ( !strlen( $read ) ) {
947  $leave = true;
948  }
949 
950  $this->mBuffer .= $read;
951  }
952 
953  if ( strlen( $this->mBuffer ) ) {
954  $return = substr( $this->mBuffer, 0, $count );
955  $this->mBuffer = substr( $this->mBuffer, $count );
956  }
957 
958  $this->mPosition += strlen( $return );
959 
960  return $return;
961  }
962 
967  function stream_write( $data ) {
968  return false;
969  }
970 
974  function stream_tell() {
975  return $this->mPosition;
976  }
977 
981  function stream_eof() {
982  return $this->mSource->atEnd();
983  }
984 
988  function url_stat() {
989  $result = array();
990 
991  $result['dev'] = $result[0] = 0;
992  $result['ino'] = $result[1] = 0;
993  $result['mode'] = $result[2] = 0;
994  $result['nlink'] = $result[3] = 0;
995  $result['uid'] = $result[4] = 0;
996  $result['gid'] = $result[5] = 0;
997  $result['rdev'] = $result[6] = 0;
998  $result['size'] = $result[7] = 0;
999  $result['atime'] = $result[8] = 0;
1000  $result['mtime'] = $result[9] = 0;
1001  $result['ctime'] = $result[10] = 0;
1002  $result['blksize'] = $result[11] = 0;
1003  $result['blocks'] = $result[12] = 0;
1004 
1005  return $result;
1006  }
1007 }
1008 
1009 class XMLReader2 extends XMLReader {
1010 
1014  function nodeContents() {
1015  if ( $this->isEmptyElement ) {
1016  return "";
1017  }
1018  $buffer = "";
1019  while ( $this->read() ) {
1020  switch ( $this->nodeType ) {
1021  case XmlReader::TEXT:
1022  case XmlReader::SIGNIFICANT_WHITESPACE:
1023  $buffer .= $this->value;
1024  break;
1025  case XmlReader::END_ELEMENT:
1026  return $buffer;
1027  }
1028  }
1029  return $this->close();
1030  }
1031 }
1032 
1038  var $importer = null;
1039 
1043  var $title = null;
1044  var $id = 0;
1045  var $timestamp = "20010115000000";
1046  var $user = 0;
1047  var $user_text = "";
1048  var $model = null;
1049  var $format = null;
1050  var $text = "";
1051  var $content = null;
1052  var $comment = "";
1053  var $minor = false;
1054  var $type = "";
1055  var $action = "";
1056  var $params = "";
1057  var $fileSrc = '';
1058  var $sha1base36 = false;
1059  var $isTemp = false;
1060  var $archiveName = '';
1062  private $mNoUpdates = false;
1063 
1068  function setTitle( $title ) {
1069  if ( is_object( $title ) ) {
1070  $this->title = $title;
1071  } elseif ( is_null( $title ) ) {
1072  throw new MWException( "WikiRevision given a null title in import. You may need to adjust \$wgLegalTitleChars." );
1073  } else {
1074  throw new MWException( "WikiRevision given non-object title in import." );
1075  }
1076  }
1077 
1081  function setID( $id ) {
1082  $this->id = $id;
1083  }
1084 
1088  function setTimestamp( $ts ) {
1089  # 2003-08-05T18:30:02Z
1090  $this->timestamp = wfTimestamp( TS_MW, $ts );
1091  }
1092 
1096  function setUsername( $user ) {
1097  $this->user_text = $user;
1098  }
1099 
1103  function setUserIP( $ip ) {
1104  $this->user_text = $ip;
1105  }
1106 
1110  function setModel( $model ) {
1111  $this->model = $model;
1112  }
1113 
1117  function setFormat( $format ) {
1118  $this->format = $format;
1119  }
1120 
1124  function setText( $text ) {
1125  $this->text = $text;
1126  }
1127 
1131  function setComment( $text ) {
1132  $this->comment = $text;
1133  }
1134 
1138  function setMinor( $minor ) {
1139  $this->minor = (bool)$minor;
1140  }
1141 
1145  function setSrc( $src ) {
1146  $this->src = $src;
1147  }
1148 
1153  function setFileSrc( $src, $isTemp ) {
1154  $this->fileSrc = $src;
1155  $this->fileIsTemp = $isTemp;
1156  }
1157 
1161  function setSha1Base36( $sha1base36 ) {
1162  $this->sha1base36 = $sha1base36;
1163  }
1164 
1168  function setFilename( $filename ) {
1169  $this->filename = $filename;
1170  }
1171 
1175  function setArchiveName( $archiveName ) {
1176  $this->archiveName = $archiveName;
1177  }
1178 
1182  function setSize( $size ) {
1183  $this->size = intval( $size );
1184  }
1185 
1189  function setType( $type ) {
1190  $this->type = $type;
1191  }
1192 
1196  function setAction( $action ) {
1197  $this->action = $action;
1198  }
1199 
1203  function setParams( $params ) {
1204  $this->params = $params;
1205  }
1206 
1210  public function setNoUpdates( $noupdates ) {
1211  $this->mNoUpdates = $noupdates;
1212  }
1213 
1217  function getTitle() {
1218  return $this->title;
1219  }
1220 
1224  function getID() {
1225  return $this->id;
1226  }
1227 
1231  function getTimestamp() {
1232  return $this->timestamp;
1233  }
1234 
1238  function getUser() {
1239  return $this->user_text;
1240  }
1241 
1247  function getText() {
1248  ContentHandler::deprecated( __METHOD__, '1.21' );
1249 
1250  return $this->text;
1251  }
1252 
1256  function getContent() {
1257  if ( is_null( $this->content ) ) {
1258  $this->content =
1260  $this->text,
1261  $this->getTitle(),
1262  $this->getModel(),
1263  $this->getFormat()
1264  );
1265  }
1266 
1267  return $this->content;
1268  }
1269 
1273  function getModel() {
1274  if ( is_null( $this->model ) ) {
1275  $this->model = $this->getTitle()->getContentModel();
1276  }
1277 
1278  return $this->model;
1279  }
1280 
1284  function getFormat() {
1285  if ( is_null( $this->model ) ) {
1286  $this->format = ContentHandler::getForTitle( $this->getTitle() )->getDefaultFormat();
1287  }
1288 
1289  return $this->format;
1290  }
1291 
1295  function getComment() {
1296  return $this->comment;
1297  }
1298 
1302  function getMinor() {
1303  return $this->minor;
1304  }
1305 
1309  function getSrc() {
1310  return $this->src;
1311  }
1312 
1316  function getSha1() {
1317  if ( $this->sha1base36 ) {
1318  return wfBaseConvert( $this->sha1base36, 36, 16 );
1319  }
1320  return false;
1321  }
1322 
1326  function getFileSrc() {
1327  return $this->fileSrc;
1328  }
1329 
1333  function isTempSrc() {
1334  return $this->isTemp;
1335  }
1336 
1340  function getFilename() {
1341  return $this->filename;
1342  }
1343 
1347  function getArchiveName() {
1348  return $this->archiveName;
1349  }
1350 
1354  function getSize() {
1355  return $this->size;
1356  }
1357 
1361  function getType() {
1362  return $this->type;
1363  }
1364 
1368  function getAction() {
1369  return $this->action;
1370  }
1371 
1375  function getParams() {
1376  return $this->params;
1377  }
1378 
1382  function importOldRevision() {
1383  $dbw = wfGetDB( DB_MASTER );
1384 
1385  # Sneak a single revision into place
1386  $user = User::newFromName( $this->getUser() );
1387  if ( $user ) {
1388  $userId = intval( $user->getId() );
1389  $userText = $user->getName();
1390  $userObj = $user;
1391  } else {
1392  $userId = 0;
1393  $userText = $this->getUser();
1394  $userObj = new User;
1395  }
1396 
1397  // avoid memory leak...?
1398  $linkCache = LinkCache::singleton();
1399  $linkCache->clear();
1400 
1401  $page = WikiPage::factory( $this->title );
1402  if ( !$page->exists() ) {
1403  # must create the page...
1404  $pageId = $page->insertOn( $dbw );
1405  $created = true;
1406  $oldcountable = null;
1407  } else {
1408  $pageId = $page->getId();
1409  $created = false;
1410 
1411  $prior = $dbw->selectField( 'revision', '1',
1412  array( 'rev_page' => $pageId,
1413  'rev_timestamp' => $dbw->timestamp( $this->timestamp ),
1414  'rev_user_text' => $userText,
1415  'rev_comment' => $this->getComment() ),
1416  __METHOD__
1417  );
1418  if ( $prior ) {
1419  // @todo FIXME: This could fail slightly for multiple matches :P
1420  wfDebug( __METHOD__ . ": skipping existing revision for [[" .
1421  $this->title->getPrefixedText() . "]], timestamp " . $this->timestamp . "\n" );
1422  return false;
1423  }
1424  $oldcountable = $page->isCountable();
1425  }
1426 
1427  # @todo FIXME: Use original rev_id optionally (better for backups)
1428  # Insert the row
1429  $revision = new Revision( array(
1430  'title' => $this->title,
1431  'page' => $pageId,
1432  'content_model' => $this->getModel(),
1433  'content_format' => $this->getFormat(),
1434  'text' => $this->getContent()->serialize( $this->getFormat() ), //XXX: just set 'content' => $this->getContent()?
1435  'comment' => $this->getComment(),
1436  'user' => $userId,
1437  'user_text' => $userText,
1438  'timestamp' => $this->timestamp,
1439  'minor_edit' => $this->minor,
1440  ) );
1441  $revision->insertOn( $dbw );
1442  $changed = $page->updateIfNewerOn( $dbw, $revision );
1443 
1444  if ( $changed !== false && !$this->mNoUpdates ) {
1445  wfDebug( __METHOD__ . ": running updates\n" );
1446  $page->doEditUpdates( $revision, $userObj, array( 'created' => $created, 'oldcountable' => $oldcountable ) );
1447  }
1448 
1449  return true;
1450  }
1451 
1455  function importLogItem() {
1456  $dbw = wfGetDB( DB_MASTER );
1457  # @todo FIXME: This will not record autoblocks
1458  if ( !$this->getTitle() ) {
1459  wfDebug( __METHOD__ . ": skipping invalid {$this->type}/{$this->action} log time, timestamp " .
1460  $this->timestamp . "\n" );
1461  return;
1462  }
1463  # Check if it exists already
1464  // @todo FIXME: Use original log ID (better for backups)
1465  $prior = $dbw->selectField( 'logging', '1',
1466  array( 'log_type' => $this->getType(),
1467  'log_action' => $this->getAction(),
1468  'log_timestamp' => $dbw->timestamp( $this->timestamp ),
1469  'log_namespace' => $this->getTitle()->getNamespace(),
1470  'log_title' => $this->getTitle()->getDBkey(),
1471  'log_comment' => $this->getComment(),
1472  #'log_user_text' => $this->user_text,
1473  'log_params' => $this->params ),
1474  __METHOD__
1475  );
1476  // @todo FIXME: This could fail slightly for multiple matches :P
1477  if ( $prior ) {
1478  wfDebug( __METHOD__ . ": skipping existing item for Log:{$this->type}/{$this->action}, timestamp " .
1479  $this->timestamp . "\n" );
1480  return;
1481  }
1482  $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
1483  $data = array(
1484  'log_id' => $log_id,
1485  'log_type' => $this->type,
1486  'log_action' => $this->action,
1487  'log_timestamp' => $dbw->timestamp( $this->timestamp ),
1488  'log_user' => User::idFromName( $this->user_text ),
1489  #'log_user_text' => $this->user_text,
1490  'log_namespace' => $this->getTitle()->getNamespace(),
1491  'log_title' => $this->getTitle()->getDBkey(),
1492  'log_comment' => $this->getComment(),
1493  'log_params' => $this->params
1494  );
1495  $dbw->insert( 'logging', $data, __METHOD__ );
1496  }
1497 
1501  function importUpload() {
1502  # Construct a file
1503  $archiveName = $this->getArchiveName();
1504  if ( $archiveName ) {
1505  wfDebug( __METHOD__ . "Importing archived file as $archiveName\n" );
1507  RepoGroup::singleton()->getLocalRepo(), $archiveName );
1508  } else {
1509  $file = wfLocalFile( $this->getTitle() );
1510  wfDebug( __METHOD__ . 'Importing new file as ' . $file->getName() . "\n" );
1511  if ( $file->exists() && $file->getTimestamp() > $this->getTimestamp() ) {
1512  $archiveName = $file->getTimestamp() . '!' . $file->getName();
1514  RepoGroup::singleton()->getLocalRepo(), $archiveName );
1515  wfDebug( __METHOD__ . "File already exists; importing as $archiveName\n" );
1516  }
1517  }
1518  if ( !$file ) {
1519  wfDebug( __METHOD__ . ': Bad file for ' . $this->getTitle() . "\n" );
1520  return false;
1521  }
1522 
1523  # Get the file source or download if necessary
1524  $source = $this->getFileSrc();
1525  $flags = $this->isTempSrc() ? File::DELETE_SOURCE : 0;
1526  if ( !$source ) {
1527  $source = $this->downloadSource();
1529  }
1530  if ( !$source ) {
1531  wfDebug( __METHOD__ . ": Could not fetch remote file.\n" );
1532  return false;
1533  }
1534  $sha1 = $this->getSha1();
1535  if ( $sha1 && ( $sha1 !== sha1_file( $source ) ) ) {
1536  if ( $flags & File::DELETE_SOURCE ) {
1537  # Broken file; delete it if it is a temporary file
1538  unlink( $source );
1539  }
1540  wfDebug( __METHOD__ . ": Corrupt file $source.\n" );
1541  return false;
1542  }
1543 
1544  $user = User::newFromName( $this->user_text );
1545 
1546  # Do the actual upload
1547  if ( $archiveName ) {
1548  $status = $file->uploadOld( $source, $archiveName,
1549  $this->getTimestamp(), $this->getComment(), $user, $flags );
1550  } else {
1551  $status = $file->upload( $source, $this->getComment(), $this->getComment(),
1552  $flags, false, $this->getTimestamp(), $user );
1553  }
1554 
1555  if ( $status->isGood() ) {
1556  wfDebug( __METHOD__ . ": Successful\n" );
1557  return true;
1558  } else {
1559  wfDebug( __METHOD__ . ': failed: ' . $status->getXml() . "\n" );
1560  return false;
1561  }
1562  }
1563 
1567  function downloadSource() {
1568  global $wgEnableUploads;
1569  if ( !$wgEnableUploads ) {
1570  return false;
1571  }
1572 
1573  $tempo = tempnam( wfTempDir(), 'download' );
1574  $f = fopen( $tempo, 'wb' );
1575  if ( !$f ) {
1576  wfDebug( "IMPORT: couldn't write to temp file $tempo\n" );
1577  return false;
1578  }
1579 
1580  // @todo FIXME!
1581  $src = $this->getSrc();
1582  $data = Http::get( $src );
1583  if ( !$data ) {
1584  wfDebug( "IMPORT: couldn't fetch source $src\n" );
1585  fclose( $f );
1586  unlink( $tempo );
1587  return false;
1588  }
1589 
1590  fwrite( $f, $data );
1591  fclose( $f );
1592 
1593  return $tempo;
1594  }
1595 
1596 }
1597 
1603  function __construct( $string ) {
1604  $this->mString = $string;
1605  $this->mRead = false;
1606  }
1607 
1611  function atEnd() {
1612  return $this->mRead;
1613  }
1614 
1618  function readChunk() {
1619  if ( $this->atEnd() ) {
1620  return false;
1621  }
1622  $this->mRead = true;
1623  return $this->mString;
1624  }
1625 }
1626 
1632  function __construct( $handle ) {
1633  $this->mHandle = $handle;
1634  }
1635 
1639  function atEnd() {
1640  return feof( $this->mHandle );
1641  }
1642 
1646  function readChunk() {
1647  return fread( $this->mHandle, 32768 );
1648  }
1649 
1654  static function newFromFile( $filename ) {
1656  $file = fopen( $filename, 'rt' );
1658  if ( !$file ) {
1659  return Status::newFatal( "importcantopen" );
1660  }
1661  return Status::newGood( new ImportStreamSource( $file ) );
1662  }
1663 
1668  static function newFromUpload( $fieldname = "xmlimport" ) {
1669  $upload =& $_FILES[$fieldname];
1670 
1671  if ( $upload === null || !$upload['name'] ) {
1672  return Status::newFatal( 'importnofile' );
1673  }
1674  if ( !empty( $upload['error'] ) ) {
1675  switch ( $upload['error'] ) {
1676  case 1: # The uploaded file exceeds the upload_max_filesize directive in php.ini.
1677  return Status::newFatal( 'importuploaderrorsize' );
1678  case 2: # The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
1679  return Status::newFatal( 'importuploaderrorsize' );
1680  case 3: # The uploaded file was only partially uploaded
1681  return Status::newFatal( 'importuploaderrorpartial' );
1682  case 6: #Missing a temporary folder.
1683  return Status::newFatal( 'importuploaderrortemp' );
1684  # case else: # Currently impossible
1685  }
1686 
1687  }
1688  $fname = $upload['tmp_name'];
1689  if ( is_uploaded_file( $fname ) ) {
1691  } else {
1692  return Status::newFatal( 'importnofile' );
1693  }
1694  }
1695 
1701  static function newFromURL( $url, $method = 'GET' ) {
1702  wfDebug( __METHOD__ . ": opening $url\n" );
1703  # Use the standard HTTP fetch function; it times out
1704  # quicker and sorts out user-agent problems which might
1705  # otherwise prevent importing from large sites, such
1706  # as the Wikimedia cluster, etc.
1707  $data = Http::request( $method, $url, array( 'followRedirects' => true ) );
1708  if ( $data !== false ) {
1709  $file = tmpfile();
1710  fwrite( $file, $data );
1711  fflush( $file );
1712  fseek( $file, 0 );
1713  return Status::newGood( new ImportStreamSource( $file ) );
1714  } else {
1715  return Status::newFatal( 'importcantopen' );
1716  }
1717  }
1718 
1727  public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false, $pageLinkDepth = 0 ) {
1728  if ( $page == '' ) {
1729  return Status::newFatal( 'import-noarticle' );
1730  }
1731  $link = Title::newFromText( "$interwiki:Special:Export/$page" );
1732  if ( is_null( $link ) || !$link->isExternal() ) {
1733  return Status::newFatal( 'importbadinterwiki' );
1734  } else {
1735  $params = array();
1736  if ( $history ) {
1737  $params['history'] = 1;
1738  }
1739  if ( $templates ) {
1740  $params['templates'] = 1;
1741  }
1742  if ( $pageLinkDepth ) {
1743  $params['pagelink-depth'] = $pageLinkDepth;
1744  }
1745  $url = $link->getFullURL( $params );
1746  # For interwikis, use POST to avoid redirects.
1747  return ImportStreamSource::newFromURL( $url, "POST" );
1748  }
1749  }
1750 }
ContentHandler\deprecated
static deprecated( $func, $version, $component=false)
Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if self::$enableDeprecationWa...
Definition: ContentHandler.php:1030
WikiImporter\processRevision
processRevision( $pageInfo, $revisionInfo)
Definition: Import.php:680
WikiImporter\$mUploadCallback
$mUploadCallback
Definition: Import.php:35
ImportStringSource\atEnd
atEnd()
Definition: Import.php:1610
WikiRevision\getUser
getUser()
Definition: Import.php:1237
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
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:189
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
WikiRevision\$content
$content
Definition: Import.php:1050
RepoGroup\singleton
static singleton()
Get a RepoGroup instance.
Definition: RepoGroup.php:53
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
content
per default it will return the text for text based content
Definition: contenthandler.txt:107
WikiRevision\getComment
getComment()
Definition: Import.php:1294
WikiRevision\downloadSource
downloadSource()
Definition: Import.php:1566
WikiImporter\setImageBasePath
setImageBasePath( $dir)
Definition: Import.php:238
WikiRevision\setNoUpdates
setNoUpdates( $noupdates)
Definition: Import.php:1209
WikiImporter\finishImportPage
finishImportPage( $title, $origTitle, $revCount, $sRevCount, $pageInfo)
Mostly for hook use.
Definition: Import.php:308
UploadSourceAdapter\$mPosition
$mPosition
Definition: Import.php:900
ImportStreamSource\atEnd
atEnd()
Definition: Import.php:1638
WikiRevision\setComment
setComment( $text)
Definition: Import.php:1130
WikiRevision\isTempSrc
isTempSrc()
Definition: Import.php:1332
WikiRevision\importUpload
importUpload()
Definition: Import.php:1500
wfSetVar
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
Definition: GlobalFunctions.php:2186
WikiRevision\getSrc
getSrc()
Definition: Import.php:1308
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3706
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
$f
$f
Definition: UtfNormalTest2.php:38
WikiImporter\$mImportUploads
$mImportUploads
Definition: Import.php:38
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2530
WikiRevision\getTitle
getTitle()
Definition: Import.php:1216
WikiRevision\getSha1
getSha1()
Definition: Import.php:1315
WikiImporter\$mRevisionCallback
$mRevisionCallback
Definition: Import.php:35
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2434
UploadSourceAdapter\url_stat
url_stat()
Definition: Import.php:988
WikiImporter\revisionCallback
revisionCallback( $revision)
Notify the callback function of a revision.
Definition: Import.php:360
WikiImporter\setNoticeCallback
setNoticeCallback( $callback)
Set a callback that displays notice messages.
Definition: Import.php:111
WikiRevision\setSha1Base36
setSha1Base36( $sha1base36)
Definition: Import.php:1160
WikiRevision\getFilename
getFilename()
Definition: Import.php:1339
WikiRevision\$archiveName
$archiveName
Definition: Import.php:1059
WikiImporter\$mPageOutCallback
$mPageOutCallback
Definition: Import.php:36
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
WikiImporter\setNoUpdates
setNoUpdates( $noupdates)
Set 'no updates' mode.
Definition: Import.php:101
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:35
WikiRevision\setText
setText( $text)
Definition: Import.php:1123
WikiImporter\processLogItem
processLogItem( $logInfo)
Definition: Import.php:557
$params
$params
Definition: styleTest.css.php:40
WikiImporter\handleRevision
handleRevision(&$pageInfo)
Definition: Import.php:639
WikiImporter\setRevisionCallback
setRevisionCallback( $callback)
Sets the action to perform as each page revision is reached.
Definition: Import.php:146
WikiRevision\$importer
$importer
Definition: Import.php:1038
WikiRevision\setFilename
setFilename( $filename)
Definition: Import.php:1167
WikiRevision\$user
$user
Definition: Import.php:1045
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:389
WikiRevision\setUsername
setUsername( $user)
Definition: Import.php:1095
WikiRevision\$mNoUpdates
$mNoUpdates
Definition: Import.php:1061
ContentHandler\getForTitle
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
Definition: ContentHandler.php:259
WikiImporter\handleContributor
handleContributor()
Definition: Import.php:828
$wgContLang
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
Definition: design.txt:56
ImportStreamSource\__construct
__construct( $handle)
Definition: Import.php:1631
ImportReporter
Reporting callback.
Definition: SpecialImport.php:408
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2118
ImportStringSource\__construct
__construct( $string)
Definition: Import.php:1602
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2154
WikiRevision\getType
getType()
Definition: Import.php:1360
ImportStreamSource
Definition: Import.php:1630
WikiImporter\nodeContents
nodeContents()
Shouldn't something like this be built-in to XMLReader? Fetches text contents of the current element,...
Definition: Import.php:390
WikiRevision\getModel
getModel()
Definition: Import.php:1272
UploadSourceAdapter\$sourceRegistrations
static $sourceRegistrations
Definition: Import.php:896
WikiImporter\$mTargetRootPage
$mTargetRootPage
Definition: Import.php:36
Revision
Definition: Revision.php:26
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
ImportStringSource
Definition: Import.php:1601
file
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
Definition: hooks.txt:93
WikiRevision\getParams
getParams()
Definition: Import.php:1374
ImportStreamSource\newFromFile
static newFromFile( $filename)
Definition: Import.php:1653
WikiRevision\setUserIP
setUserIP( $ip)
Definition: Import.php:1102
WikiRevision\$params
$params
Definition: Import.php:1055
Http\request
static request( $method, $url, $options=array())
Perform an HTTP request.
Definition: HttpFunctions.php:62
MWException
MediaWiki exception.
Definition: MWException.php:26
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:103
WikiRevision\getFormat
getFormat()
Definition: Import.php:1283
WikiImporter\importLogItem
importLogItem( $rev)
Default per-revision callback, performs the import.
Definition: Import.php:284
UploadSourceAdapter\stream_tell
stream_tell()
Definition: Import.php:974
UploadSourceAdapter\stream_read
stream_read( $count)
Definition: Import.php:938
ImportStreamSource\newFromURL
static newFromURL( $url, $method='GET')
Definition: Import.php:1700
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
WikiImporter\dumpTemp
dumpTemp( $contents)
Definition: Import.php:780
WikiRevision\getTimestamp
getTimestamp()
Definition: Import.php:1230
$wgCommandLineMode
global $wgCommandLineMode
Definition: Setup.php:408
WikiRevision\setModel
setModel( $model)
Definition: Import.php:1109
MWContentSerializationException
Exception representing a failure to serialize or unserialize a content object.
Definition: ContentHandler.php:33
wfMessage
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 an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
WikiRevision\setMinor
setMinor( $minor)
Definition: Import.php:1137
WikiRevision\$user_text
$user_text
Definition: Import.php:1046
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4058
WikiImporter\throwXmlError
throwXmlError( $err)
Definition: Import.php:63
WikiImporter\processTitle
processTitle( $text)
Definition: Import.php:852
MWNamespace\hasSubpages
static hasSubpages( $index)
Does the namespace allow subpages?
Definition: Namespace.php:325
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
UploadSourceAdapter\stream_write
stream_write( $data)
Definition: Import.php:967
WikiRevision\$comment
$comment
Definition: Import.php:1051
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
form
null means default in associative array form
Definition: hooks.txt:1530
wfTimestampNow
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
Definition: GlobalFunctions.php:2561
WikiImporter\processUpload
processUpload( $pageInfo, $uploadInfo)
Definition: Import.php:791
WikiImporter\setImportUploads
setImportUploads( $import)
Definition: Import.php:245
WikiImporter\$mNoUpdates
$mNoUpdates
Definition: Import.php:39
UploadSourceAdapter\$mSource
$mSource
Definition: Import.php:898
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
WikiImporter\dumpElement
dumpElement()
Left in for debugging.
Definition: Import.php:413
XMLReader2
Definition: Import.php:1009
WikiRevision\$text
$text
Definition: Import.php:1049
ContentHandler\makeContent
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
Definition: ContentHandler.php:144
ImportStreamSource\newFromInterwiki
static newFromInterwiki( $interwiki, $page, $history=false, $templates=false, $pageLinkDepth=0)
Definition: Import.php:1726
XMLReader2\nodeContents
nodeContents()
Definition: Import.php:1014
WikiRevision\setID
setID( $id)
Definition: Import.php:1080
$options
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 & $options
Definition: hooks.txt:1530
Http\get
static get( $url, $timeout='default', $options=array())
Simple wrapper for Http::request( 'GET' )
Definition: HttpFunctions.php:99
WikiRevision\getArchiveName
getArchiveName()
Definition: Import.php:1346
WikiRevision\setFormat
setFormat( $format)
Definition: Import.php:1116
WikiRevision\getMinor
getMinor()
Definition: Import.php:1301
WikiRevision\getText
getText()
Definition: Import.php:1246
WikiRevision\getContent
getContent()
Definition: Import.php:1255
WikiImporter\$mPageCallback
$mPageCallback
Definition: Import.php:35
TS_MW
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Definition: GlobalFunctions.php:2478
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:980
WikiRevision\$timestamp
$timestamp
Definition: Import.php:1044
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
WikiImporter\$mSiteInfoCallback
$mSiteInfoCallback
Definition: Import.php:36
WikiRevision\$sha1base36
$sha1base36
Definition: Import.php:1057
WikiRevision\$minor
$minor
Definition: Import.php:1052
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
WikiRevision\$fileSrc
$fileSrc
Definition: Import.php:1056
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
action
action
Definition: parserTests.txt:378
$size
$size
Definition: RandomTest.php:75
$value
$value
Definition: styleTest.css.php:45
UploadSourceAdapter\stream_open
stream_open( $path, $mode, $options, &$opened_path)
Definition: Import.php:921
WikiRevision\setType
setType( $type)
Definition: Import.php:1188
WikiImporter\importRevision
importRevision( $revision)
Default per-revision callback, performs the import.
Definition: Import.php:254
WikiRevision\$action
$action
Definition: Import.php:1054
WikiRevision\$model
$model
Definition: Import.php:1047
WikiImporter\doImport
doImport()
Primary entry point.
Definition: Import.php:455
WikiImporter\$mTargetNamespace
$mTargetNamespace
Definition: Import.php:36
WikiImporter\$mImageBasePath
$mImageBasePath
Definition: Import.php:38
WikiImporter\notice
notice( $msg)
Definition: Import.php:78
$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:2578
WikiImporter\setDebug
setDebug( $debug)
Set debug mode...
Definition: Import.php:93
WikiImporter\$reader
$reader
Definition: Import.php:34
WikiRevision\setTitle
setTitle( $title)
Definition: Import.php:1067
WikiRevision\setTimestamp
setTimestamp( $ts)
Definition: Import.php:1087
WikiImporter\pageOutCallback
pageOutCallback( $title, $origTitle, $revCount, $sucCount, $pageInfo)
Notify the callback function when a "</page>" is closed.
Definition: Import.php:348
File\DELETE_SOURCE
const DELETE_SOURCE
Definition: File.php:65
only
published in in Madrid In the first edition of the Vocabolario for was published In in Rotterdam was the Dictionnaire Universel ! html< p > The first monolingual dictionary written in a Romance language was< i > Sebastián Covarrubias</i >< i > Tesoro de la lengua castellana o published in in Madrid In the first edition of the< i > Vocabolario dell< a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)"> Accademia della Crusca</a ></i > for was published In in Rotterdam was the< i > Dictionnaire Universel</i ></p > ! end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html php< p >< i > foo</i ></p > ! html parsoid< p >< i > foo</i >< b ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! options ! wikitext foo ! html< p >< b >< i > foo</i ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< i ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< b ></b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s family</b ></i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s</b > family</i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo</i ></b >< i > s family</i ></p > !end ! test Italics and ! options ! wikitext this is about foo s family ! html< p >< i > this is about</i > foo< b > s family</b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo s</i > family</b ></p > !end ! test Italicized possessive ! wikitext The s talk page ! html< p > The< i >< a href="/wiki/Main_Page" title="Main Page"> Main Page</a ></i > s talk page</p > ! end ! test Parsoid only
Definition: parserTests.txt:396
WikiImporter\handleUpload
handleUpload(&$pageInfo)
Definition: Import.php:725
WikiImporter\setUploadCallback
setUploadCallback( $callback)
Sets the action to perform as each file upload version is reached.
Definition: Import.php:157
WikiImporter\warn
warn( $data)
Definition: Import.php:74
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
WikiImporter\handleSiteInfo
handleSiteInfo()
Definition: Import.php:511
$count
$count
Definition: UtfNormalTest2.php:96
WikiImporter\setTargetRootPage
setTargetRootPage( $rootpage)
Set a target root page under which all pages are imported.
Definition: Import.php:207
$rev
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1337
$args
if( $line===false) $args
Definition: cdb.php:62
WikiRevision\setParams
setParams( $params)
Definition: Import.php:1202
Title
Represents a title within MediaWiki.
Definition: Title.php:35
WikiImporter\$mNoticeCallback
$mNoticeCallback
Definition: Import.php:37
WikiRevision\importLogItem
importLogItem()
Definition: Import.php:1454
WikiRevision\$fileIsTemp
$fileIsTemp
Definition: Import.php:1060
$debug
$debug
Definition: Setup.php:518
WikiRevision\setSrc
setSrc( $src)
Definition: Import.php:1144
User\idFromName
static idFromName( $name)
Get database id given a user name.
Definition: User.php:503
wfTempDir
wfTempDir()
Tries to get the system directory for temporary files.
Definition: GlobalFunctions.php:2611
WikiRevision\$type
$type
Definition: Import.php:1053
type
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition: postgres.txt:22
UploadSourceAdapter
This is a horrible hack used to keep source compatibility.
Definition: Import.php:895
WikiRevision
Definition: Import.php:1037
WikiImporter\debug
debug( $data)
Definition: Import.php:68
WikiRevision\setFileSrc
setFileSrc( $src, $isTemp)
Definition: Import.php:1152
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
in
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
Definition: maintenance.txt:1
WikiImporter\__construct
__construct( $source)
Creates an ImportXMLReader drawing from the source provided.
Definition: Import.php:45
WikiRevision\setArchiveName
setArchiveName( $archiveName)
Definition: Import.php:1174
WikiRevision\getFileSrc
getFileSrc()
Definition: Import.php:1325
wfBaseConvert
wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine='auto')
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to...
Definition: GlobalFunctions.php:3424
WikiImporter\importUpload
importUpload( $revision)
Dummy for now...
Definition: Import.php:294
UploadSourceAdapter\$mBuffer
$mBuffer
Definition: Import.php:899
WikiImporter\handleLogItem
handleLogItem()
Definition: Import.php:521
WikiRevision\$format
$format
Definition: Import.php:1048
WikiRevision\$title
Title $title
Definition: Import.php:1042
$path
$path
Definition: NoLocalSettings.php:35
format
if the prop value should be in the metadata multi language array format
Definition: hooks.txt:1230
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
User
User
Definition: All_system_messages.txt:425
WikiImporter\setSiteInfoCallback
setSiteInfoCallback( $callback)
Sets the action to perform when site info is encountered.
Definition: Import.php:179
WikiRevision\importOldRevision
importOldRevision()
Definition: Import.php:1381
WikiImporter\setPageOutCallback
setPageOutCallback( $callback)
Sets the action to perform as each page in the stream is completed.
Definition: Import.php:135
WikiImporter\debugRevisionHandler
debugRevisionHandler(&$revision)
Alternate per-revision callback, for debugging.
Definition: Import.php:317
$source
if(PHP_SAPI !='cli') $source
Definition: mwdoc-filter.php:18
WikiRevision\getID
getID()
Definition: Import.php:1223
ImportStringSource\readChunk
readChunk()
Definition: Import.php:1617
WikiImporter\handlePage
handlePage()
Definition: Import.php:582
WikiRevision\setAction
setAction( $action)
Definition: Import.php:1195
UploadSourceAdapter\registerSource
static registerSource( $source)
Definition: Import.php:906
that
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if that
Definition: deferred.txt:11
WikiImporter\setPageCallback
setPageCallback( $callback)
Sets the action to perform as each new page in the stream is reached.
Definition: Import.php:120
WikiImporter\setTargetNamespace
setTargetNamespace( $namespace)
Set a target namespace to override the defaults.
Definition: Import.php:190
WikiRevision\setSize
setSize( $size)
Definition: Import.php:1181
wfLocalFile
wfLocalFile( $title)
Get an object referring to a locally registered file.
Definition: GlobalFunctions.php:3760
WikiImporter\logItemCallback
logItemCallback( $revision)
Notify the callback function of a new log item.
Definition: Import.php:374
WikiRevision\getSize
getSize()
Definition: Import.php:1353
WikiRevision\getAction
getAction()
Definition: Import.php:1367
LinkCache\singleton
static & singleton()
Get an instance of this class.
Definition: LinkCache.php:49
OldLocalFile\newFromArchiveName
static newFromArchiveName( $title, $repo, $archiveName)
Definition: OldLocalFile.php:59
UploadSourceAdapter\stream_eof
stream_eof()
Definition: Import.php:981
WikiImporter\pageCallback
pageCallback( $title)
Notify the callback function when a new "<page>" is reached.
Definition: Import.php:334
WikiRevision\$isTemp
$isTemp
Definition: Import.php:1058
ImportStreamSource\readChunk
readChunk()
Definition: Import.php:1645
WikiImporter\$mLogItemCallback
$mLogItemCallback
Definition: Import.php:35
WikiImporter\$mDebug
$mDebug
Definition: Import.php:37
ImportStreamSource\newFromUpload
static newFromUpload( $fieldname="xmlimport")
Definition: Import.php:1667
WikiImporter\setLogItemCallback
setLogItemCallback( $callback)
Sets the action to perform as each log item reached.
Definition: Import.php:168
Status\newFatal
static newFatal( $message)
Factory function for fatal errors.
Definition: Status.php:63
$changed
$changed
Definition: UtfNormalGenerate.php:130
WikiRevision\$id
$id
Definition: Import.php:1043
wfRandomString
wfRandomString( $length=32)
Get a random string containing a number of pseudo-random hex characters.
Definition: GlobalFunctions.php:347
$type
$type
Definition: testCompression.php:46