User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:importexport

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mantisbt:importexport [2008/03/22 14:06] giallumantisbt:importexport [2024/03/26 05:03] (current) – [Other] formatting xmllint code block dregad
Line 2: Line 2:
  
    * **Author**: Gianluca Sforna (giallu)    * **Author**: Gianluca Sforna (giallu)
-   * **Status**: <del>Draft</del> | Work in Progress | <del>Implemented</del>+   * **Status**: <del>Draft</del><del>Work in Progress</del> | Implemented
    * **Associated Issue**: http://www.mantisbt.org/bugs/view.php?id=4220    * **Associated Issue**: http://www.mantisbt.org/bugs/view.php?id=4220
 +
  
 ===== Introduction ===== ===== Introduction =====
 A complete solution for copying a list of issues between two different Mantis instances is something asked from quite some time: A complete solution for copying a list of issues between two different Mantis instances is something asked from quite some time:
  
-http://www.mantisbt.org/bugs/view.php?id=4220+  * http://www.mantisbt.org/bugs/view.php?id=4220 
 +  * http://www.mantisbt.org/bugs/view.php?id=5310
  
 For a greater flexibility, the use of an XML format looks like the best option (XML export was also asked in http://www.mantisbt.org/bugs/view.php?id=4024). For a greater flexibility, the use of an XML format looks like the best option (XML export was also asked in http://www.mantisbt.org/bugs/view.php?id=4024).
Line 22: Line 24:
   * Log in instance B as project manager   * Log in instance B as project manager
   * Import the XML file and watch instance B populated with new bugs   * Import the XML file and watch instance B populated with new bugs
- 
  
 The first implementation will support all the issue fields (including extended info) and custom fields. The first implementation will support all the issue fields (including extended info) and custom fields.
  
 Given the extensible nature of the XML format, this feature can be enhanced later to support notes, attachments and all other informations related to the issue. Given the extensible nature of the XML format, this feature can be enhanced later to support notes, attachments and all other informations related to the issue.
 +
  
  
 ===== Design choices and issues ===== ===== Design choices and issues =====
  
-The main hurdle for this feature is to define the behavior when any piece of information is an internal reference to instance A.+The main hurdle for this feature is to define the behaviour when any piece of information is an internal reference to instance A.
  
 This includes: This includes:
Line 42: Line 44:
 ** Proposed solution ** ** Proposed solution **
  
-import will happen on a single project in instance B, so warn the user on export if "All project" is selected+import will happen on a single project in instance B 
 + 
 +** Status ** 
 + 
 +DONE 
  
 === User IDs === === User IDs ===
Line 54: Line 61:
 On import page, ask what to do with users. Options are: On import page, ask what to do with users. Options are:
   * squash all ids to a single one in instance B   * squash all ids to a single one in instance B
-  * attempt to find a matching user by username, then fallback to squashing id+  * attempt to find a matching user by username, then fall back to squashing id 
 + 
 +** Status ** 
 + 
 +DONE 
 +A function implementing the above behaviour exists, but composing a list of users is memory intensive (more than 32Mb to execute with the mantis DB) so I'm refraining from using it. 
 + 
 +The current implementation tries by default to match usernames, then squash to the userID performing the import operation
  
  
Line 70: Line 84:
   * Replace them with fake links, pretending the linked bug or note was deleted   * Replace them with fake links, pretending the linked bug or note was deleted
  
 +** Status **
 +
 +DONE (notes are not in the initial implementation, but code can support those)
 +
 +
 +
 +=== Categories ===
 +** Issue ** 
 +
 +Category is a required field, but nothing guarantees the target project on instance B will use the same ones as instance A.
 +
 +** Proposed solution **
 +
 +Add import options:
 +  * skip import of issues with unknown categories
 +  * create missing categories (dangerous...)
 +
 +** Status **
 +
 +PENDING
  
  
Line 100: Line 134:
  
 === STEP 3 details === === STEP 3 details ===
 +<code>
   open XML file   open XML file
-  create oldID => newID maps for: issues, users+  initialize oldID => newID array for: issues, notes
   for each <issue> element   for each <issue> element
     create a new Bugdata object     create a new Bugdata object
-FIXME +    populate data with <issue> fields 
-     +    save it into DB 
-    +    save oldID => newID pair
  
 +  for each element in (issues, notes)
 +    load data from DB
 +    search fields for links
 +    for each link found
 +      if link ID is known
 +        replace it with known newID
 +      else
 +        replace it with a conventional string or with URL to item in instance A
 +</code>
  
-===== Other =====+===== Requirements =====
  
-  * The resulting xml file can be tested for validity with xmllint like: 
  
-  ''xmllint --noout --dtdvalid mantis.dtd export_file.xml''+The code being developed depends on: 
 +  * PHP 5 
 +  * XMLReader module 
 +  * XMLWRiter module 
 + 
 + 
 +===== Other ===== 
 + 
 +  * The resulting xml file can be tested for validity with xmllint like: <code> 
 +xmllint --noout --dtdvalid mantis.dtd exported_issues.xml 
 +</code>
  
-  * Check memory consumption when a huge number of issues are exported+  * Check memory consumption when a huge number of issues are exported and imported 
 +  * Add checks for required extensions - bool extension_loaded  ( string $name  ) 
 +  * let user choose destination project on instance B
  
  
mantisbt/importexport.1206209211.txt.gz · Last modified: 2008/10/29 04:31 (external edit)

Driven by DokuWiki