16 import(
'lib.pkp.plugins.importexport.users.PKPUserImportExportPlugin');
23 function register($category, $path, $mainContextId =
null) {
24 return parent::register($category, $path, $mainContextId);
31 echo __(
'plugins.importexport.users.cliUsage', array(
32 'scriptName' => $scriptName,
33 'pluginName' => $this->
getName()
35 echo __(
'plugins.importexport.users.cliUsage.examples', array(
36 'scriptName' => $scriptName,
37 'pluginName' => $this->
getName()
45 $command = array_shift($args);
46 $xmlFile = array_shift($args);
47 $journalPath = array_shift($args);
54 $journal = $journalDao->getByPath($journalPath);
57 if ($journalPath !=
'') {
58 echo __(
'plugins.importexport.common.cliError') .
"\n";
59 echo __(
'plugins.importexport.common.error.unknownJournal', array(
'journalPath' => $journalPath)) .
"\n\n";
61 $this->
usage($scriptName);
66 $xmlFile = PWD .
'/' . $xmlFile;
68 $outputDir = dirname($xmlFile);
69 if (!is_writable($outputDir) || (file_exists($xmlFile) && !is_writable($xmlFile))) {
70 echo __(
'plugins.importexport.common.cliError') .
"\n";
71 echo __(
'plugins.importexport.common.export.error.outputFileNotWritable', array(
'param' => $xmlFile)) .
"\n\n";
72 $this->
usage($scriptName);
78 $this->
importUsers(file_get_contents($xmlFile), $journal,
null);
83 file_put_contents($xmlFile, $this->
exportAllUsers($journal,
null));
86 file_put_contents($xmlFile, $this->
exportUsers($args, $journal,
null));
92 $this->
usage($scriptName);