Beispiel #1
0
 public function handle($data)
 {
     global $case;
     foreach ($data as $value => $key) {
         if ($value != 'table') {
             $count = substr_count($key, '|');
             if ($count > 0) {
                 $temp = explode('|', $key);
                 $key = '';
                 $length = count($temp);
                 for ($i = 0; $i < $length; $i++) {
                     $key .= $temp[$i] . '   ';
                 }
             }
             $case .= $value . '   ' . $key . ',';
         }
     }
     //去掉最后的逗号
     $case = rtrim($case, ',') . ')';
     $temp = "create table {$data->table}(";
     $sql = $temp . $case;
     $record = migrate::execute($sql);
     if ($record == false) {
         echo "{$data->table}创建失败了=";
     } else {
         echo "{$data->table}创建成功了=";
     }
     unset($case);
     // echo $sql;
 }
Beispiel #2
0
        parent::CommandLineTool($argv);
        if (!isset($this->argv[0]) || !isset($this->argv[1])) {
            $this->usage();
            exit(1);
        }
        $this->conferencePath = $this->argv[0];
        $this->importPath = $this->argv[1];
        $this->options = array_slice($this->argv, 2);
    }
    /**
     * Print command usage information.
     */
    function usage()
    {
        echo "OCS 1 -> OCS 2 migration tool (requires OCS >= 1.1.5 and OCS >= 2.0.1)\n" . "Use this tool to import data from an OCS 1 system into an OCS 2 system\n\n" . "Usage: {$this->scriptName} [conference_path] [ocs1_path] [options]\n" . "conference_path   Conference path to create (E.g., \"ocs\")\n" . "                  If path already exists, all content except conference settings\n" . "                  will be imported into the existing conference\n" . "ocs1_path         Complete local filesystem path to the OCS 1 installation\n" . "                  (E.g., \"/var/www/ocs\")\n" . "options           importRegistrations - import registration type and registrant\n" . "                  data\n" . "                  verbose - print additional debugging information\n" . "                  emailUsers - Email created users with login information\n";
    }
    /**
     * Execute the import command.
     */
    function execute()
    {
        $importer = new ImportOCS1();
        if ($importer->import($this->conferencePath, $this->importPath, $this->options)) {
            printf("Import completed\n" . "Users imported:     %u\n" . "Papers imported:  %u\n", $importer->userCount, $importer->paperCount);
        } else {
            printf("Import failed!\nERROR: %s\n", $importer->error());
        }
    }
}
$tool = new migrate(isset($argv) ? $argv : array());
$tool->execute();
     * @param int    $errno   Contains the level of the error raised, as an integer.
     * @param string $errstr  The error message.
     * @param string $errfile The file in which the error occured.
     * @param int    $errline The line in the file on which the error occured.
     *
     * @return void
     *
     * @throws \ErrorException Always, the error converted to an ErrorException.
     */
    public function handleError($errno, $errstr, $errfile, $errline)
    {
        if ($errno === E_NOTICE) {
            return;
        }
        throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
    }
    /**
     * Migrate form legacy column set editor.
     *
     * @return void
     */
    private function migrateFromLegacy()
    {
        if (!$this->database->fieldExists('bootstrap_grid', 'tl_content') && $this->database->fieldExists('columnset_id', 'tl_content')) {
            $this->database->query('ALTER TABLE tl_content ADD bootstrap_grid int(10) unsigned NOT NULL default \'0\';');
            $this->database->query('UPDATE tl_content SET bootstrap_grid=columnset_id WHERE bootstrap_grid = 0');
        }
    }
}
$migrate = new migrate();
$migrate->run();