} $versionNames[$temp_project_id][$row['name']] = $row['id']; $version = new stdClass(); $version->id = $row['id']; $version->project_id = $temp_project_id; $version->name = $row['name']; $versions[$row['id']] = $version; } // Map Bugzilla Bugs and Comments to Redmine Issues and Journals $issues = array(); $journals = array(); $bug_id = 0; $sql = "SELECT bugs.bug_id, \r\n\t\t bugs.assigned_to, \r\n\t\t bugs.bug_status, \r\n\t\t bugs.creation_ts, \r\n\t\t bugs.short_desc, \r\n\t\t bugs.product_id, \r\n\t\t\t products.name,\r\n\t\t bugs.reporter, \r\n\t\t bugs.version,\r\n\t\t bugs.resolution, \r\n\t\t bugs.bug_severity,\r\n\t\t bugs.priority,\r\n\t\t bugs.component_id,\r\n\t\t longdescs.comment_id, \r\n\t\t longdescs.thetext, \r\n\t\t longdescs.bug_when, \r\n\t\t longdescs.who, \r\n\t\t longdescs.isprivate\r\n\t\t FROM bugs, longdescs, products \r\n\t\t WHERE bugs.bug_id = longdescs.bug_id AND products.id = bugs.product_id\r\n\t\t ORDER BY bugs.creation_ts, longdescs.bug_when"; $result = mysqli_query($mysqlCon, $sql) or die(mysqli_error() . $sql); //largestIssue returns the largest id in issue table. $largestid = largestIssue(); $largestjourid = 88; while ($row = mysqli_fetch_array($result)) { if ($row['bug_id'] != $bug_id) { // New bug $issue = new stdClass(); $issue->id = $row['bug_id'] + $largestid; //$issue->project_id = mapprojectid($row['name']); foreach ($projectmaps as $index => $projectmap) { if ($projectmap->originid == $row['product_id']) { $issue->project_id = $projectmap->newid; } } $issue->subject = $row['short_desc']; $issue->description = $row['thetext']; $issue->created_on = $row['creation_ts'];
$issueTrackers = array("blocker" => "Bug", "critical" => "Bug", "major" => "Bug", "normal" => "Bug", "minor" => "Bug", "trivial" => "Bug", "enhancement" => "Bug"); $issueServerity = array("blocker" => "Blocker", "critical" => "Critical", "major" => "Major", "normal" => "Normal", "minor" => "Minor", "trivial" => "Trivial", "enhancement" => "Enhancement"); $issueResolution = array("FIXED" => "Fixed", "INVALID" => "Invalid", "WONTFIX" => "Won''t Fix", "LATER" => "Later", "REMIND" => "Remind", "DUPLICATE" => "Duplicate", "WORKSFORME" => "Worksforme", "MOVED" => "Moved"); //7. Component map $redmine_components = array("algorithmdevelopment" => "Algorithm development", "amboot" => "Amboot", "dspucode" => "DSP ucode", "h264decode" => "H264 decode", "h264encode" => "H264 encode", "iav/dspdriver" => "IAV / DSP driver", "imagealgo" => "Image Algo", "imagekernel(ik)" => "Image Kernel (IK)", "imagequalitytuning" => "Image quality tuning", "imageproclibrary" => "Image proc library", "iqtool" => "IQ tool", "linuxkernel" => "Linux Kernel", "network(wifi&bt)" => "Network (Wifi & BT)", "oryx(mw)" => " Oryx (MW)", "sensordriver" => "Sensor driver", "unittest&apps" => "Unit test & Apps"); //8. custom field $component_id = 2; $resolution_field_id = 10; $serverity_field_id = 11; // get the issue info in buzilla database $issues = array(); $issue_updates = array(); $sql = "SELECT DISTINCT \r\n\t\t\t products.name as name,\r\n\t\t\t version,\r\n\t\t\t components.name as comname,\r\n\t\t\t components.product_id as com_project,\r\n\t\t bugs.bug_id, \r\n\t\t bugs.assigned_to, \r\n\t\t bugs.bug_status, \r\n\t\t bugs.creation_ts, \r\n\t\t bugs.short_desc, \r\n\t\t bugs.product_id, \r\n\t\t bugs.reporter, \r\n\t\t bugs.version,\r\n\t\t bugs.resolution, \r\n\t\t bugs.bug_severity,\r\n\t\t bugs.priority,\r\n\t\t bugs.component_id,\r\n\t\t longdescs.thetext\r\n\t\t FROM bugs,longdescs,products,components\r\n\t\t WHERE bugs.bug_id = longdescs.bug_id AND products.id=bugs.product_id\r\n\t\t\t\tAND components.id = bugs.component_id\r\n\t\t ORDER BY bugs.creation_ts"; $result = mysqli_query($mysqlCon, $sql) or die(mysqli_error() . $sql); //largestIssue returns the largest id in Redmine issue table. $largestissueid = largestIssue(); $issueindex = 0; $bug_id = 0; while ($row = mysqli_fetch_array($result)) { if ($row['bug_id'] != $bug_id) { $bug_id = $row['bug_id']; $issueFlag = 0; foreach ($issuesmaps as $index => $issuesmap) { if ($row['bug_id'] == $issuesmap->bugissueid) { //This bug needs to be updated. $issueFlag = 1; $issue_update = new stdClass(); $issue_update->id = $issuesmap->redissueid; $issue_update->bugid = $row['bug_id']; $issue_update->bug_resolution = $row['resolution']; $issue_update->bug_status = $row['bug_status'];