Jeremy D commited on 2011-11-06 15:51:30
Showing 1 changed files, with 18 additions and 15 deletions.
... | ... |
@@ -628,7 +628,7 @@ class mbt_to_tbg extends tbg_converter |
628 | 628 |
$password = $this->getRandomString(); |
629 | 629 |
|
630 | 630 |
$this->tbg_db->query(' |
631 |
- INSERT INTO ' . $this->tbg_db_prefix . 'users (id, username, buddyname, realname, email, password, enabled, lastseen, joined) |
|
631 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'users (id, username, buddyname, realname, email, password, enabled, lastseen, joined) |
|
632 | 632 |
VALUES (' . $row['id'] . ', "' . $row['username'] . '", "' . $row['buddyname'] . '", "' . $row['realname'] . '", "' . $row['email'] . '", "' . $password . '", ' . $row['enabled'] . ', ' . $row['lastseen'] . ', ' . $row['joined'] . ')'); |
633 | 633 |
|
634 | 634 |
++$i; |
... | ... |
@@ -657,12 +657,12 @@ class mbt_to_tbg extends tbg_converter |
657 | 657 |
foreach ($this->mantis_db->query($query) as $row) |
658 | 658 |
{ |
659 | 659 |
$this->tbg_db->query(' |
660 |
- INSERT INTO ' . $this->tbg_db_prefix . 'projects (id, name, locked, description) |
|
661 |
- VALUES (' . $row['id'] . ', "' . $row['name'] . '", ' . $row['locked'] . ', "' . $row['description'] . '")'); |
|
660 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'projects (id, name, locked, description, scope, workflow_scheme_id, issuetype_scheme_id) |
|
661 |
+ VALUES (' . $row['id'] . ', "' . $row['name'] . '", ' . $row['locked'] . ', "' . $row['description'] . '", 1, 1, 1)'); |
|
662 | 662 |
|
663 | 663 |
// Add the default permissions. |
664 | 664 |
$this->tbg_db->query(' |
665 |
- INSERT INTO ' . $this->tbg_db_prefix . 'permissions (permission_type, target_id, allowed, module, uid, gid, tid, scope) VALUES |
|
665 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'permissions (permission_type, target_id, allowed, module, uid, gid, tid, scope) VALUES |
|
666 | 666 |
("canseeproject", ' . $row['id'] . ', 1, "core", 1, 0, 0, 1), |
667 | 667 |
("canseeprojecthierarchy", ' . $row['id'] . ', 1, "core", 1, 0, 0, 1), |
668 | 668 |
("canmanageproject", ' . $row['id'] . ', 1, "core", 1, 0, 0, 1), |
... | ... |
@@ -711,7 +711,7 @@ class mbt_to_tbg extends tbg_converter |
711 | 711 |
continue; |
712 | 712 |
|
713 | 713 |
$this->tbg_db->query(' |
714 |
- INSERT INTO ' . $this->tbg_db_prefix . 'listtypes (name, itemtype, scope) |
|
714 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'listtypes (name, itemtype, scope) |
|
715 | 715 |
VALUES ("' . $row['name'] . '", "category", 1)'); |
716 | 716 |
|
717 | 717 |
++$i; |
... | ... |
@@ -751,7 +751,7 @@ class mbt_to_tbg extends tbg_converter |
751 | 751 |
continue; |
752 | 752 |
|
753 | 753 |
$this->tbg_db->query(' |
754 |
- INSERT INTO ' . $this->tbg_db_prefix . 'builds (name, isreleased, project) VALUES ("' . $row['version'] . '", ' . $row['isreleased'] . ', ' . $row['project'] . ')'); |
|
754 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'builds (name, isreleased, project) VALUES ("' . $row['version'] . '", ' . $row['isreleased'] . ', ' . $row['project'] . ')'); |
|
755 | 755 |
|
756 | 756 |
$builds[$row['version']] = $this->tbg_db->lastInsertId(); |
757 | 757 |
|
... | ... |
@@ -783,7 +783,10 @@ class mbt_to_tbg extends tbg_converter |
783 | 783 |
$query = ' |
784 | 784 |
SELECT |
785 | 785 |
bt.id, bt.project_id, bt.summary AS title, bt.handler_id AS assigned_to, bt.duplicate_id AS duplicate_of, |
786 |
- bt.date_submitted AS posted, bt.last_updated, bt.status AS state, bt.category_id AS category, bt.resolution, |
|
786 |
+ bt.date_submitted AS posted, bt.last_updated, |
|
787 |
+ 0 AS state /* NEEDS FIXED */, |
|
788 |
+ |
|
789 |
+ bt.category_id AS category, bt.resolution, |
|
787 | 790 |
bt.priority, |
788 | 791 |
bt.severity /* NEEDS FIXED */, |
789 | 792 |
(CASE |
... | ... |
@@ -803,7 +806,7 @@ class mbt_to_tbg extends tbg_converter |
803 | 806 |
foreach ($this->mantis_db->query($query) as $row) |
804 | 807 |
{ |
805 | 808 |
$this->tbg_db->query(' |
806 |
- INSERT INTO ' . $this->tbg_db_prefix . 'issues (id, project_id, title, assigned_to, duplicate_of, posted, last_updated, state, category, resolution, priority, severity, reproducability) |
|
809 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'issues (id, project_id, title, assigned_to, duplicate_of, posted, last_updated, state, category, resolution, priority, severity, reproducability) |
|
807 | 810 |
VALUES (' . $row['id'] . ', ' . $row['project_id'] . ', "' . $row['title'] . '", ' . $row['assigned_to'] . ', ' . $row['duplicate_of'] . ', ' . $row['posted'] . ', ' . $row['last_updated'] . ', ' . $row['state'] . ', ' . $row['category'] . ', ' . $row['resolution'] . ', ' . $row['priority'] . ', ' . $row['severity'] . ', ' . $row['reproducability'] . ') |
808 | 811 |
'); |
809 | 812 |
|
... | ... |
@@ -811,7 +814,7 @@ class mbt_to_tbg extends tbg_converter |
811 | 814 |
if (!isset($builds[$row['version']])) |
812 | 815 |
{ |
813 | 816 |
$this->tbg_db->query(' |
814 |
- INSERT INTO (' . $this->tbg_db_prefix . 'builds (name, project) VALUES (' . $row['version'] . ', ' . $row['project_id'] . ')'); |
|
817 |
+ REPLACE INTO (' . $this->tbg_db_prefix . 'builds (name, project) VALUES (' . $row['version'] . ', ' . $row['project_id'] . ')'); |
|
815 | 818 |
|
816 | 819 |
$builds[$row['version']] = $this->tbg_db->lastInsertId(); |
817 | 820 |
} |
... | ... |
@@ -819,7 +822,7 @@ class mbt_to_tbg extends tbg_converter |
819 | 822 |
$affect_id = $builds[$row['version']]; |
820 | 823 |
|
821 | 824 |
$this->tbg_db->query(' |
822 |
- INSERT INTO (' . $this->tbg_db_prefix . 'issueaffectsbuild (id, build) VALUES(' . $row['id'] . ', ' . $affect_id . ')'); |
|
825 |
+ REPLACE INTO (' . $this->tbg_db_prefix . 'issueaffectsbuild (id, build) VALUES(' . $row['id'] . ', ' . $affect_id . ')'); |
|
823 | 826 |
|
824 | 827 |
++$i; |
825 | 828 |
} |
... | ... |
@@ -848,7 +851,7 @@ class mbt_to_tbg extends tbg_converter |
848 | 851 |
foreach ($this->mantis_db->query($query) as $row) |
849 | 852 |
{ |
850 | 853 |
$this->tbg_db->query(' |
851 |
- INSERT INTO ' . $this->tbg_db_prefix . 'comments (id, target_id, updated, posted, updated_by, posted_by, content) |
|
854 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'comments (id, target_id, updated, posted, updated_by, posted_by, content) |
|
852 | 855 |
VALUES (' . $row['id'] . ', ' . $row['target_id'] . ', ' . $row['updated'] . ', ' . $row['posted'] . ', ' . $row['updated_by'] . ', ' . $row['posted_by'] . ', "' . $row['content'] . '")'); |
853 | 856 |
|
854 | 857 |
++$i; |
... | ... |
@@ -876,7 +879,7 @@ class mbt_to_tbg extends tbg_converter |
876 | 879 |
foreach ($this->mantis_db->query($query) as $row) |
877 | 880 |
{ |
878 | 881 |
$this->tbg_db->query(' |
879 |
- INSERT INTO ' . $this->tbg_db_prefix . 'issuerelations (parent_id, child_id) |
|
882 |
+ REPLACE INTO ' . $this->tbg_db_prefix . 'issuerelations (parent_id, child_id) |
|
880 | 883 |
VALUES (' . $row['parent_id'] . ', ' . $row['child_id'] . ')'); |
881 | 884 |
|
882 | 885 |
++$i; |
... | ... |
@@ -929,7 +932,7 @@ class mbt_to_tbg extends tbg_converter |
929 | 932 |
{ |
930 | 933 |
// Get the basics - we'll fix it up in a minute. |
931 | 934 |
$this->db->query(' |
932 |
- INSERT INTO ' . $this->tbg_prefix . 'issues |
|
935 |
+ REPLACE INTO ' . $this->tbg_prefix . 'issues |
|
933 | 936 |
id, project_id, title, assigned_to, duplicate_of, posted, last_updated, |
934 | 937 |
state, category, resolution, priority, severity, reproducability |
935 | 938 |
SELECT bt.id, bt.project_id, bt.summary AS title, bt.handler_id AS assigned_to, |
... | ... |
@@ -999,7 +1002,7 @@ class mbt_to_tbg extends tbg_converter |
999 | 1002 |
public function getComments() |
1000 | 1003 |
{ |
1001 | 1004 |
$this->db->query(' |
1002 |
- INSERT INTO ' . $this->tbg_prefix . 'comments |
|
1005 |
+ REPLACE INTO ' . $this->tbg_prefix . 'comments |
|
1003 | 1006 |
target_id, updated, posted, updated_by, posted_by, content |
1004 | 1007 |
SELECT bn.bug_id AS target_id, bn.last_modified AS updated, bn.date_submitted AS posted, |
1005 | 1008 |
bn.reporter_id AS updated_by, bn.reporter_id AS posted_by, btt.note AS content |
... | ... |
@@ -1013,7 +1016,7 @@ class mbt_to_tbg extends tbg_converter |
1013 | 1016 |
public function getProjects() |
1014 | 1017 |
{ |
1015 | 1018 |
$this->db->query(' |
1016 |
- INSERT INTO ' . $this->tbg_prefix . 'projects |
|
1019 |
+ REPLACE INTO ' . $this->tbg_prefix . 'projects |
|
1017 | 1020 |
id, name, locked, description |
1018 | 1021 |
SELECT id, name, enabled AS locked, description |
1019 | 1022 |
FROM ' . $this->mtb_prefix . 'project_table' |
1020 | 1023 |