MantisBT-WackoWiki Integration

Current version: 0.2
Compatible with: R6.x and MantisBT 2.x
Credits: WikiAdmin
URL: https://www.mantisbt.org/

1. Integrate WackoWiki into MantisBT

Implemented in MantisBT 2.26.0.


This will add a direct link to your WackoWiki in your Mantis Bug Tracker.


  1. to the [Project] Wiki page depending on the project name on the left menu
    • Mantis-WackoWiki Integration: Link to Project Wiki page

  1. to the [Project]/[IssueNUMBER] Wiki page on top of an issue in MantisBT
    • Mantis-WackoWiki Integration: Link to Issue Wiki page

1.1. Apply the patch to your MantisBT installation


  • core/classes/MantisCoreWikiPlugin.class.php
  • core/wiki_api.php

file:wackowiki_integration_mantis2.1.0.patch

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -3782,7 +3782,7 @@
 
 /**
  * Wiki Engine.
- * Supported engines: 'dokuwiki', 'mediawiki', 'twiki', 'wikka', 'xwiki'
+ * Supported engines: 'dokuwiki', 'mediawiki', 'twiki', 'wackowiki', 'wikka', 'xwiki'
  * @global string $g_wiki_engine
  */
 $g_wiki_engine = '';
diff --git a/core/classes/MantisCoreWikiPlugin.class.php b/core/classes/MantisCoreWikiPlugin.class.php
--- a/core/classes/MantisCoreWikiPlugin.class.php
+++ b/core/classes/MantisCoreWikiPlugin.class.php
@@ -218,6 +218,65 @@
 }
 
 /**
+ * Basic WackoWiki support with old-style wiki integration.
+ */
+class MantisCoreWackowikiPlugin extends MantisCoreWikiPlugin {
+    /**
+     * Plugin Registration
+     * @return void
+     */
+    function register() {
+        $this->name = 'MantisBT WackoWiki Integration';
+        $this->version = '0.1';
+        $this->requires = array(
+            'MantisCore' => '2.0.0',
+        );
+    }
+
+    /**
+     * Wiki base url
+     *
+     * @param integer $p_project_id A project identifier.
+     * @return string
+     */
+    function base_url( $p_project_id = null ) {
+        $t_base = plugin_config_get( 'engine_url' ) . '';
+
+        $t_namespace = ucfirst( plugin_config_get( 'root_namespace' ) );
+        if( !is_blank( $t_namespace ) ) {
+            $t_base .= $t_namespace . '/';
+        }
+
+        if( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
+            $t_base .= urlencode( project_get_name( $p_project_id ) ) . '/';
+        }
+        return $t_base;
+    }
+
+    /**
+     * Wiki link to a bug
+     *
+     * @param integer $p_event  Event.
+     * @param integer $p_bug_id A bug identifier.
+     * @return string
+     */
+    function link_bug( $p_event, $p_bug_id ) {
+        return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'Issue' . (int)$p_bug_id;
+    }
+
+    /**
+     * Wiki link to a project
+     *
+     * @param integer $p_event      Event.
+     * @param integer $p_project_id A project identifier.
+     * @return string
+     */
+    function link_project( $p_event, $p_project_id ) {
+        return $this->base_url( $p_project_id ) . '';
+    }
+}
+
+/**
  * Basic WikkaWiki support with old-style wiki integration.
  */
 class MantisCoreWikkaWikiPlugin extends MantisCoreWikiPlugin {
diff --git a/core/wiki_api.php b/core/wiki_api.php
--- a/core/wiki_api.php
+++ b/core/wiki_api.php
@@ -70,6 +70,9 @@
         case 'twiki':
             plugin_child( 'MantisCoreTwiki' );
             break;
+        case 'wackowiki':
+            plugin_child( 'MantisCoreWackowiki' );
+            break;
         case 'WikkaWiki':
             plugin_child( 'MantisCoreWikkaWiki' );
             break;

1.2. Add the following settings to your MantisBT


  • config/config.inc.php

####################
# Wiki Integration #
####################

$g_wiki_enable = ON;

$g_wiki_engine = 'wackowiki';

$g_wiki_root_namespace = 'Bugs';

$g_wiki_engine_url = 'https://example.com/wiki/';	

4. Now it should work. Enjoy!

2. Possible problems and solutions

2.1. Wiki Integration settings


$g_wiki_enable

Set to ON to enable Wiki integration. Defaults to OFF.

$g_wiki_engine

value: 'wackowiki'

$g_wiki_root_namespace

Wiki namespace to be used as root for all pages relating to this MantisBT installation.
e.g. 'Bugs' or leave it empty

Namespace: /Bugs/Project/IssueNUMBER
  1. root namespace
  2. project name
  3. issue number

$g_wiki_engine_url

URL under which the wiki engine is hosted.


value: '' (empty)

Must be on the same server as MantisBT, requires a trailing '/'.
If left empty (default), the URL is derived from the global MantisBT path, replacing the URL's path component by the wiki engine string, i.e. if
  1. $g_path = 'http://example.com/mantis/'
  2. $g_wiki_engine = 'wackowiki',
  3. the wiki URL will be 'http://example.com/wackowiki/'.

value: 'https://example.com/wiki/'

3. Links

  1. WackoWiki site: https://wackowiki.org/
  2. Mantis site: https://www.mantisbt.org/
  3. https://www.mantisbt.org/bugs/view.php?id=22371 -> implemented with MantisBT 2.26.0
  4. Example: https://wackowiki.org/bugs/

Files

mantis_wiki_issue.png Mantis-WackoWiki Integration: Link to Issue Wiki page 10.2 KiB  14.02.2017 13:10 
mantis_wiki.png Mantis-WackoWiki Integration: Link to Project Wiki page 25.3 KiB  14.02.2017 13:05 
wackowiki_integration_mantis2.1.0.patch Patch for MantisBT 2.1.0 4.7 KiB  29.06.2020 06:28