/**
  * @throws RuntimeException
  * @return boolean
  */
 public function run()
 {
     $this->unregisterUploadsource();
     $start = microtime(true);
     $config = null;
     $source = ImportStreamSource::newFromFile($this->assertThatFileIsReadableOrThrowException($this->file));
     if (!$source->isGood()) {
         throw new RuntimeException('Import returned with error(s) ' . serialize($source->errors));
     }
     // WikiImporter::__construct without a Config instance was deprecated in MediaWiki 1.25.
     if (class_exists('\\ConfigFactory')) {
         $config = \ConfigFactory::getDefaultInstance()->makeConfig('main');
     }
     $importer = new WikiImporter($source->value, $config);
     $importer->setDebug($this->verbose);
     $reporter = new ImportReporter($importer, false, '', false);
     $reporter->setContext($this->acquireRequestContext());
     $reporter->open();
     $this->exception = false;
     try {
         $importer->doImport();
     } catch (\Exception $e) {
         $this->exception = $e;
     }
     $this->result = $reporter->close();
     $this->importTime = microtime(true) - $start;
     $this->testEnvironment->executePendingDeferredUpdates();
     return $this->result->isGood() && !$this->exception;
 }
 /**
  * @since 1.9.2
  */
 public function run()
 {
     $conds = '';
     if ($this->type !== null) {
         $conds = "job_cmd = " . $this->dbConnectionProvider->getConnection()->addQuotes($this->type);
     }
     while ($this->dbConnectionProvider->getConnection()->selectField('job', 'job_id', $conds, __METHOD__)) {
         $job = $this->type === null ? $this->pop() : $this->pop_type($this->type);
         if (!$job) {
             break;
         }
         wfWaitForSlaves();
         $this->status[] = array('type' => $job->command, 'status' => $job->run());
     }
     $this->testEnvironment->executePendingDeferredUpdates();
 }
 /**
  * @since 2.1
  *
  * @param array $poolOfPages
  */
 public function doDeletePoolOfPages(array $poolOfPages)
 {
     foreach ($poolOfPages as $page) {
         if ($page instanceof WikiPage || $page instanceof DIWikiPage) {
             $page = $page->getTitle();
         }
         if (is_string($page)) {
             $page = Title::newFromText($page);
         }
         if (!$page instanceof Title) {
             continue;
         }
         $this->deletePage($page);
     }
     $this->testEnvironment->executePendingDeferredUpdates();
 }
 /**
  * @since 2.3
  *
  * @return PageCreator
  */
 public function doMoveTo(Title $target, $isRedirect = true)
 {
     $this->getPage()->getTitle()->moveTo($target, false, "integration test", $isRedirect);
     $this->testEnvironment->executePendingDeferredUpdates();
     return $this;
 }