00001 <?php
00002
00015
00016
00017 require(dirname(__FILE__) . '/bootstrap.inc.php');
00018
00019 import('site.ImportOCS1');
00020
00021 class migrate extends CommandLineTool {
00022
00024 var $conferencePath;
00025
00027 var $importPath;
00028
00030 var $options;
00031
00036 function migrate($argv = array()) {
00037 parent::CommandLineTool($argv);
00038
00039 if (!isset($this->argv[0]) || !isset($this->argv[1])) {
00040 $this->usage();
00041 exit(1);
00042 }
00043
00044 $this->conferencePath = $this->argv[0];
00045 $this->importPath = $this->argv[1];
00046 $this->options = array_slice($this->argv, 2);
00047 }
00048
00052 function usage() {
00053 echo "OCS 1 -> OCS 2 migration tool (requires OCS >= 1.1.5 and OCS >= 2.0.1)\n"
00054 . "Use this tool to import data from an OCS 1 system into an OCS 2 system\n\n"
00055 . "Usage: {$this->scriptName} [conference_path] [ocs1_path] [options]\n"
00056 . "conference_path Conference path to create (E.g., \"ocs\")\n"
00057 . " If path already exists, all content except conference settings\n"
00058 . " will be imported into the existing conference\n"
00059 . "ocs1_path Complete local filesystem path to the OCS 1 installation\n"
00060 . " (E.g., \"/var/www/ocs\")\n"
00061 . "options importRegistrations - import registration type and registrant\n"
00062 . " data\n"
00063 . " verbose - print additional debugging information\n"
00064 . " emailUsers - Email created users with login information\n";
00065 }
00066
00070 function execute() {
00071 $importer = new ImportOCS1();
00072 if ($importer->import($this->conferencePath, $this->importPath, $this->options)) {
00073 printf("Import completed\n"
00074 . "Users imported: %u\n"
00075 . "Papers imported: %u\n",
00076 $importer->userCount,
00077 $importer->paperCount);
00078 } else {
00079 printf("Import failed!\nERROR: %s\n", $importer->error());
00080 }
00081 }
00082
00083 }
00084
00085 $tool = new migrate(isset($argv) ? $argv : array());
00086 $tool->execute();
00087 ?>