public function execute() { // Parse the po file. $p = new PoImporter($this->getOption('file')); $p->setProgressCallback(array($this, 'myOutput')); list($changes, $group) = $p->parse(); if (!count($changes)) { $this->output("No changes to import\n"); exit(0); } // Import changes to wiki. $w = new WikiWriter($changes, $group, $this->getOption('user'), !$this->hasOption('really')); $w->setProgressCallback(array($this, 'myOutput')); $w->execute(); }
if ( !isset( $options['user'] ) ) { STDERR( "You need to specify user name for wiki import" ); exit( 1 ); } if ( !count( $changes ) ) { STDOUT( "No changes to import" ); exit( 0 ); } /** * Import changes to wiki. */ $w = new WikiWriter( $changes, $group, $options['user'], !isset( $options['really'] ) ); $w->execute(); /** * Parses a po file that has been exported from Mediawiki. Other files are not * supported. */ class PoImporter { /** * Path to file to parse. */ private $file = false; public function __construct( $file ) { $this->file = $file; }