コード例 #1
0
 /**
  * Creates an ImportXMLReader drawing from the source provided
  * @param ImportSource $source
  * @param Config $config
  */
 function __construct(ImportSource $source, Config $config = null)
 {
     $this->reader = new XMLReader();
     if (!$config) {
         wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
         $config = ConfigFactory::getDefaultInstance()->makeConfig('main');
     }
     $this->config = $config;
     if (!in_array('uploadsource', stream_get_wrappers())) {
         stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     }
     $id = UploadSourceAdapter::registerSource($source);
     if (defined('LIBXML_PARSEHUGE')) {
         $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
     } else {
         $this->reader->open("uploadsource://{$id}");
     }
     // Default callbacks
     $this->setPageCallback(array($this, 'beforeImportPage'));
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
     $this->importTitleFactory = new NaiveImportTitleFactory();
 }
コード例 #2
0
ファイル: Import.php プロジェクト: GodelDesign/Godel
 /**
  * Creates an ImportXMLReader drawing from the source provided
  */
 function __construct($source)
 {
     $this->reader = new XMLReader();
     stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     $id = UploadSourceAdapter::registerSource($source);
     $this->reader->open("uploadsource://{$id}");
     // Default callbacks
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
 }
コード例 #3
0
ファイル: Import.php プロジェクト: whysasse/kmwiki
 /**
  * Creates an ImportXMLReader drawing from the source provided
  * @param ImportStreamSource $source
  */
 function __construct(ImportStreamSource $source)
 {
     $this->reader = new XMLReader();
     if (!in_array('uploadsource', stream_get_wrappers())) {
         stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     }
     $id = UploadSourceAdapter::registerSource($source);
     if (defined('LIBXML_PARSEHUGE')) {
         $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
     } else {
         $this->reader->open("uploadsource://{$id}");
     }
     // Default callbacks
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
 }
コード例 #4
0
ファイル: Import.php プロジェクト: xiebinyi/mediawiki
 /**
  * Creates an ImportXMLReader drawing from the source provided
  * @param ImportSource $source
  * @param Config $config
  * @throws Exception
  */
 function __construct(ImportSource $source, Config $config = null)
 {
     if (!class_exists('XMLReader')) {
         throw new Exception('Import requires PHP to have been compiled with libxml support');
     }
     $this->reader = new XMLReader();
     if (!$config) {
         wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
         $config = ConfigFactory::getDefaultInstance()->makeConfig('main');
     }
     $this->config = $config;
     if (!in_array('uploadsource', stream_get_wrappers())) {
         stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     }
     $id = UploadSourceAdapter::registerSource($source);
     // Enable the entity loader, as it is needed for loading external URLs via
     // XMLReader::open (T86036)
     $oldDisable = libxml_disable_entity_loader(false);
     if (defined('LIBXML_PARSEHUGE')) {
         $status = $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
     } else {
         $status = $this->reader->open("uploadsource://{$id}");
     }
     if (!$status) {
         $error = libxml_get_last_error();
         libxml_disable_entity_loader($oldDisable);
         throw new MWException('Encountered an internal error while initializing WikiImporter object: ' . $error->message);
     }
     libxml_disable_entity_loader($oldDisable);
     // Default callbacks
     $this->setPageCallback(array($this, 'beforeImportPage'));
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
     $this->importTitleFactory = new NaiveImportTitleFactory();
 }