MediaWiki  master
ApiImportReporter.php
Go to the documentation of this file.
1 <?php
26 
32  private $mResultArr = [];
33 
42  public function reportPage( ?PageIdentity $pageIdentity, $foreignTitle, $revisionCount, $successCount, $pageInfo ) {
43  // Add a result entry
44  $r = [];
45 
46  if ( $pageIdentity === null ) {
47  # Invalid or non-importable title
48  $r['title'] = $pageInfo['title'];
49  $r['invalid'] = true;
50  } else {
51  $titleFactory = MediaWikiServices::getInstance()->getTitleFactory();
52  ApiQueryBase::addTitleInfo( $r, $titleFactory->newFromPageIdentity( $pageIdentity ) );
53  $r['revisions'] = (int)$successCount;
54  }
55 
56  $this->mResultArr[] = $r;
57 
58  // Piggyback on the parent to do the logging
59  parent::reportPage( $pageIdentity, $foreignTitle, $revisionCount, $successCount, $pageInfo );
60  }
61 
62  public function getData() {
63  return $this->mResultArr;
64  }
65 }
Import reporter for the API.
reportPage(?PageIdentity $pageIdentity, $foreignTitle, $revisionCount, $successCount, $pageInfo)
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Reporting callback.
Service locator for MediaWiki core services.
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
Interface for objects (potentially) representing an editable wiki page.