Exemplo n.º 1
0
 function modifyPages($source, $editSummary, $forPagesThatExist)
 {
     $text = "";
     $xml_parser = new DTXMLParser($source);
     $xml_parser->doParse();
     $jobs = array();
     $job_params = array();
     global $wgUser;
     $job_params['user_id'] = $wgUser->getId();
     $job_params['edit_summary'] = $editSummary;
     $job_params['for_pages_that_exist'] = $forPagesThatExist;
     foreach ($xml_parser->mPages as $page) {
         $title = Title::newFromText($page->getName());
         $job_params['text'] = $page->createText();
         $jobs[] = new DTImportJob($title, $job_params);
     }
     Job::batchInsert($jobs);
     global $wgLang;
     $text .= wfMsgExt('dt_import_success', array('parse'), $wgLang->formatNum(count($jobs)), 'XML');
     return $text;
 }
Exemplo n.º 2
0
 function modifyPages($source, $editSummary, $forPagesThatExist)
 {
     $text = "";
     $xml_parser = new DTXMLParser($source);
     $xml_parser->doParse();
     $jobs = array();
     $job_params = array();
     $job_params['user_id'] = $this->getUser()->getId();
     $job_params['edit_summary'] = $editSummary;
     $job_params['for_pages_that_exist'] = $forPagesThatExist;
     foreach ($xml_parser->mPages as $page) {
         $title = Title::newFromText($page->getName());
         $job_params['text'] = $page->createText();
         $jobs[] = new DTImportJob($title, $job_params);
     }
     // MW 1.21+
     if (class_exists('JobQueueGroup')) {
         JobQueueGroup::singleton()->push($jobs);
     } else {
         Job::batchInsert($jobs);
     }
     $text .= $this->msg('dt_import_success')->numParams(count($jobs))->params('XML')->parseAsBlock();
     return $text;
 }