public function execute()
 {
     $logger = new MaintenanceDebugLogger($this);
     if ($this->getOption('debug')) {
         $logger->setMaximumLevel(LogLevel::DEBUG);
     } else {
         $logger->setMaximumLevel(LogLevel::INFO);
     }
     $importer = Flow\Container::get('importer');
     $talkpageManagerUser = FlowHooks::getOccupationController()->getTalkpageManager();
     $dbw = wfGetDB(DB_MASTER);
     $strategy = new ConversionStrategy($dbw, new FileImportSourceStore($this->getOption('logfile')), new LocalApiBackend($talkpageManagerUser), Container::get('url_generator'), $talkpageManagerUser, Container::get('controller.notification'));
     $converter = new \Flow\Import\Converter($dbw, $importer, $logger, $talkpageManagerUser, $strategy);
     $startId = $this->getOption('startId');
     $stopId = $this->getOption('stopId');
     $logger->info("Starting full wiki LQT conversion of all pages with use-liquid-threads property");
     $titles = new PagesWithPropertyIterator($dbw, 'use-liquid-threads', $startId, $stopId);
     $converter->convertAll($titles);
     $logger->info("Finished conversion");
 }
 public function execute()
 {
     $cacheDir = $this->getOption('cacheremoteapidir');
     if (!is_dir($cacheDir)) {
         if (!mkdir($cacheDir)) {
             throw new Flow\Exception\FlowException('Provided dir for caching remote api calls is not creatable.');
         }
     }
     if (!is_writable($cacheDir)) {
         throw new Flow\Exception\FlowException('Provided dir for caching remote api calls is not writable.');
     }
     $api = new RemoteApiBackend($this->getOption('remoteapi'), $cacheDir);
     $importer = Flow\Container::get('importer');
     $importer->setAllowUnknownUsernames(true);
     $talkPageManagerUser = \FlowHooks::getOccupationController()->getTalkpageManager();
     $srcPageName = $this->getOption('srcpage');
     if ($this->hasOption('dstpage')) {
         $dstPageName = $this->getOption('dstpage');
     } else {
         $dstPageName = $srcPageName;
     }
     $dstTitle = Title::newFromText($dstPageName);
     $source = new LiquidThreadsApiImportSource($api, $srcPageName, $talkPageManagerUser);
     $logFilename = $this->getOption('logfile');
     $sourceStore = new FileImportSourceStore($logFilename);
     $logger = new MaintenanceDebugLogger($this);
     if ($this->getOption('debug')) {
         $logger->setMaximumLevel(LogLevel::DEBUG);
     } else {
         $logger->setMaximumLevel(LogLevel::INFO);
     }
     $importer->setLogger($logger);
     $api->setLogger($logger);
     $logger->info("Starting LQT conversion of page {$srcPageName}");
     $importer->import($source, $dstTitle, $sourceStore);
     $logger->info("Finished LQT conversion of page {$srcPageName}");
 }
 public function execute()
 {
     $talkPageManagerUser = \FlowHooks::getOccupationController()->getTalkpageManager();
     $api = new LocalApiBackend($talkPageManagerUser);
     $importer = Container::get('importer');
     $srcPageName = $this->getOption('srcpage');
     $logFilename = $this->getOption('logfile');
     $sourceStore = new FileImportSourceStore($logFilename);
     $dbw = wfGetDB(DB_MASTER);
     $logger = new MaintenanceDebugLogger($this);
     if ($this->getOption('debug')) {
         $logger->setMaximumLevel(LogLevel::DEBUG);
     } else {
         $logger->setMaximumLevel(LogLevel::INFO);
     }
     $strategy = new LiquidThreadsApiConversionStrategy($dbw, $sourceStore, $api, Container::get('url_generator'), $talkPageManagerUser, Container::get('controller.notification'));
     $importer->setLogger($logger);
     $api->setLogger($logger);
     $converter = new \Flow\Import\Converter($dbw, $importer, $logger, $talkPageManagerUser, $strategy);
     $logger->info("Starting LQT conversion of page {$srcPageName}");
     $srcTitle = \Title::newFromText($srcPageName);
     $converter->convertAll(array($srcTitle));
     $logger->info("Finished LQT conversion of page {$srcPageName}");
 }