Forge command line/6.1

From FusionForge Wiki
Revision as of 18:33, 2 January 2018 by Nerville (talk | contribs) (Import/Export functions)

Jump to: navigation, search

This page in other versions: master

FusionForge provides a php script forge located in ~/bin/ which supports general commands to perform such as plugins activation/deactivate and some import/export features.

This script has a basic internal help:

 ./forge help

Plugin Activation/Deactivation

It provides the capability to activate or deactivate forge-wide a plugin.
To activate:

 ./forge pluginActivate <name_of_the_plugin>

To deactivate:

 ./forge pluginDeactivate <name_of_the_plugin>

Import/Export functions

File Format

Import & export functions support 2 file formats:

  • json (default)
  • raw: this format is pure PHP Array.

The export functions echo information on stdout. To generate a file, redirect the stdout to a file.

Get binary data to an export element

By default, all export function does not retrive any binary data (documents, artifact attachments, etc.). To retrieve the binary data, use the getZipDump function. This function generates a zip with all binary data as described in the parameter file.

 ./forge getZipDump <parameter_file> [json|raw]

How to generate import files

The easiest way to generate import files is to use export functions, i.e: use userDump to generate the json file, then modify this file to reflect the needs and use it as import file.


To export an existing user:

 ./forge userDump <user_id> [json|raw]

To import an user:

 ./forge userImport <file> [json|raw]

Sample import json file:

     "data_array": {
         "user_name": "admin",
         "email": "root@localhost.localdomain",
         "firstname": "Forge",
         "lastname": "Admin",
         "theme_id": "5",
         "password": "Inject123$",

The command line supports user by user import only. To import multiple users, create one file per user then loop on the files to call the forge userImport function.


The forge command line supports import and export project.

To export a project:

 ./forge groupDump <group_id> [json|raw]

To import a project:

 ./forge groupImport <file> [json|raw]

The command line supports project by project import only. To import multiple projects, you need to loop on the groupImport function.

Document Management

The forge command line supports document, folder or the full document management import/export.

To export a document:

To import a document:

To export a folder:

To import a folder:

To export the full document management:

To import the full document management:


The forge command line supports artifact or tracker export/import.

To export an artifact:

 ./forge artifactDump <artifact_id> [json|raw]

Sample export as json file of an artifact:

     "associatedFromArray": [
     "associatedToArray": [
     "associationCounter": 0,
     "children": null,
     "data_array": {
         "0": "22",
         "artifact_id": "22",
         "1": "104",
         "group_artifact_id": "104",
         "2": "1",
         "status_id": "1",
         "3": "1",
         "priority": "1",
         "4": "103",
         "submitted_by": "103",
         "5": "100",
         "assigned_to": "100",
         "6": "1496243461",
         "open_date": "1496243461",
         "7": "0",
         "close_date": "0",
         "8": "my new bug",
         "summary": "my new bug",
         "9": "the new bug:\r\n\r\n* markdown?",
         "details": "the new bug:\r\n\r\n* markdown?",
         "10": "None",
         "assigned_unixname": "None",
         "11": "Nobody",
         "assigned_realname": "Nobody",
         "12": "noreply@sourceforge.net",
         "assigned_email": "noreply@sourceforge.net",
         "13": "testuser",
         "submitted_unixname": "testuser",
         "14": "Test USER",
         "submitted_realname": "Test USER",
         "15": "test.user@localhost.localdomain",
         "submitted_email": "test.user@localhost.localdomain",
         "16": "Open",
         "status_name": "Open",
         "17": "1514916965",
         "last_modified_date": "1514916965",
         "18": "103",
         "last_modified_by": "103",
         "19": "testuser",
         "last_modified_unixname": "testuser",
         "20": "Test USER",
         "last_modified_realname": "Test USER",
         "21": "test.user@localhost.localdomain",
         "last_modified_email": "test.user@localhost.localdomain"
     "error_code": 0,
     "error_message": null,
     "error_state": false,
     "extra_field_data": {
         "106": {
             "name": "custom",
             "value": "None",
             "type": "1",
             "element_id": "100"
         "110": {
             "name": "My Text",
             "value": "",
             "type": "4"
         "108": {
             "name": "status",
             "value": "Open",
             "type": "7",
             "element_id": "20"
         "109": {
             "name": "Date de d\u00e9but",
             "value": "",
             "type": "12"
         "112": {
             "name": "Dependencies",
             "value": "",
             "type": "23"
     "files": null,
     "history": [
             "id": "296",
             "artifact_id": "22",
             "field_name": "details",
             "old_value": "the new bug:\r\n*markdown?",
             "entrydate": "1514916943",
             "user_name": "testuser"
             "id": "295",
             "artifact_id": "22",
             "field_name": "details",
             "old_value": "the new bug",
             "entrydate": "1514916928",
             "user_name": "testuser"
     "messages": [
             "id": "113",
             "artifact_id": "22",
             "from_email": "test.user@localhost.localdomain",
             "body": "another comment:\r\n\r\n* markdown?",
             "adddate": "1514916965",
             "user_id": "103",
             "email": "test.user@localhost.localdomain",
             "user_name": "testuser",
             "realname": "Test USER"
             "id": "112",
             "artifact_id": "22",
             "from_email": "test.user@localhost.localdomain",
             "body": "my specific comment:\r\n* markdown format\r\n",
             "adddate": "1514916453",
             "user_id": "103",
             "email": "test.user@localhost.localdomain",
             "user_name": "testuser",
             "realname": "Test USER"
     "monitor": [
     "parent": null,
     "related_tasks": null,
     "relatedtasks": [
     "status_res": null,
     "votes": [

To import an artifact:

 ./forge artifactImport <file> [json|raw]

To export a tracker:

 ./forge trackerDump <tracker_id> [json|raw]

To import a tracker:

 ./forge trackerImport <file> [json|raw]

File Release System

Project Management