cancel
Showing results for 
Search instead for 
Did you mean: 

Mediawiki Integration with Labs (stable)

philnicholls
Champ in-the-making
Champ in-the-making
Hi all,

I think I have had mediawiki successfully integrated with Alfresco labs 3c in the past (i.e. I could browse wiki content, but not edit it, from Alfresco).

I've now moved to labs stable, but I get an install error:


16:20:43,868 INFO  [org.alfresco.repo.module.ModuleServiceImpl] Found 2 module(s
).
16:20:43,919 INFO  [org.alfresco.repo.module.ModuleServiceImpl] Starting module
'phpIntegration' version 1.0.
16:20:44,091 INFO  [org.alfresco.repo.module.ModuleServiceImpl] Installing modul
e 'org.alfresco.module.mediawikiintegration' version 1.1.
16:20:44,921 ERROR [org.springframework.web.context.ContextLoader] Context initi
alization failed
org.alfresco.error.AlfrescoRuntimeException: Failed to execute transaction-level
behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnCre
ateNodePolicy.onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationR
ef) in transaction 10de3d11-2b4e-4587-ab24-5b5a22baff21
        at org.alfresco.repo.policy.TransactionBehaviourQueue.execute(Transactio
nBehaviourQueue.java:201)
        at org.alfresco.repo.policy.TransactionBehaviourQueue.beforeCommit(Trans
actionBehaviourQueue.java:133)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionS
ynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:710)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionS
ynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:690)
….

Has anyone successfully managed to get mediawiki to work with Alfresco labs (stable)?  [or should I just go back to 3c 🙂 ]
Thanks
Phil
20 REPLIES 20

mfischer
Champ in-the-making
Champ in-the-making
Attention: I'm not a developer, just only a sysadmin, i.e. I don't really know if this opens security holes. It should not affect other Alfresco components, but rmember - you've to do this at your own risk!

For those who still want to try the MediaWiki extension with the actual ALF CE releases: This way I got the extension running with ALF CE 3.2r and 3.3g (the hint came from the JIRA-ticket:

At first setup a SVN environment as discribed here or there (did this a few month in the past, don't remember the exact steps :wink: ), I use Eclipse Galileo with a complete HEAD copy, but it should be possible with the pure mediawiki extension sources from the SVN, but you will have to write your own build.xml-file, I guess. If you commonly deal with Java you might be able to use the pure sources with "javac" executable at the commandline.

Important is the MediaWiki Integration-tree, where the MediaWiki extension is located. In this subtree look at source/java/org/alfresco/module/mediawikiintegration/MediaWikiService.java. This is the module which has to be modified.

But at first have a look at the tree, none of its components must show red symbols at its icons (this belongs only to this special tree, it doesn't matter what other trees are showing). If there are some, you have to resolve these errors first, usually by correcting pathes or java compiler settings. For more information about this use the Alfresco Developer Guide.
To setup Eclipse to compile modules automatically makes things more easier.

Load the MediaWikiService.java into the editor by double click on it. Search for the following string: "public void onCreateNode" or klick "onCreateNode" in the object browser on the right side. This is the first procedure we want to change. Add the following lines:

       // Added for repairing the broken MW amp
       AuthenticationUtil.setRunAsUserSystem();

Now it should look like this:

    public void onCreateNode(ChildAssociationRef childAssocRef)
    {
        // Added for repairing the broken MW amp
        AuthenticationUtil.setRunAsUserSystem();
        // The newly created mediawiki space
        NodeRef mediawiki = childAssocRef.getChildRef();
       
        // Set the default values for the various configuration properties
        String wikiName = (String)this.nodeService.getProperty(mediawiki, ContentModel.PROP_NAME);


After saving the document Eclipse recompiles the class file automatically (if setted up to do this, otherwise do it manually).

Now it would be possible to implement the extension to a running Alfresco installation, but for working with it there is another necessary, otherwise you would not be able do delete wiki spaces later.

Go to the onDeleteNode procedure and add the code as shown above, it should look like this (the original procedure is empty):

    public void onDeleteNode(ChildAssociationRef childAssocRef,
            boolean isNodeArchived)
    {
        // Added for repairing the broken MW amp
        AuthenticationUtil.setRunAsUserSystem();
       
    }

Save (and compile) it again, change to a file manager and look for the file "MediaWikiService.class" in the Eclipse workspace path. In my installation it is located at "c:\workspace_alfresco\alfresco\HEAD\root\modules\MediaWiki Integration\build\classes\org\alfresco\module\mediawikiintegration\", but that depends on how you configured your dev-environment.

This file has now to be inserted into the alfresco-mediawiki-integration-<ALF-VERSION>.jar-file, which is part of the MediaWiki-AMP. download the AMP-File for your Alfresco version, for 3.3g you can use the 3.4dev-version from here, because no official package for 3.3g has been released.

Open the AMP-file with a zip program like 7-zip and got to the "lib"-folder. Open the the JAR-file (7-zip can do this without unpacking it) and copy the newly compiled "MediaWikiServices.class" into the subfolder "\org\alfresco\module\mediawikiintegration\" by overwriting the old file. Close the zip program and confirm the request for saving the changes.

Copy the modified AMP-file to your Alfresco server and install it the common way (don't forget to install the php integration module first) or inject it in a running - but broken by MediaWiki - Alfresco instance.
After installing it and cleaning the Tomcat working directories start Tomcat and have a look at the system/catalina log: it should show some database commands instead of java errors. If you can see this, you're done Smiley Very Happy.