MediaWiki  master
ApiImportReporter.php
Go to the documentation of this file.
1 <?php
25 
31  private $mResultArr = [];
32 
41  public function reportPage( ?PageIdentity $pageIdentity, $foreignTitle, $revisionCount, $successCount, $pageInfo ) {
42  // Add a result entry
43  $r = [];
44 
45  if ( $pageIdentity === null ) {
46  # Invalid or non-importable title
47  $r['title'] = $pageInfo['title'];
48  $r['invalid'] = true;
49  } else {
50  $titleFactory = MediaWikiServices::getInstance()->getTitleFactory();
51  // @phan-suppress-next-line PhanTypeMismatchArgumentNullable castFrom does not return null here
52  ApiQueryBase::addTitleInfo( $r, $titleFactory->castFromPageIdentity( $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.
Interface for objects (potentially) representing an editable wiki page.