WoodWing Help Center

Migrating custom-made Server plug-ins to Enterprise Server 10

Migrating custom-made Server plug-ins to Enterprise Server 10

Your custom-made Enterprise Server Plug-ins that were developed for previous versions of Enterprise Server might no longer be compatible with Enterprise 9.

Ask your integrator to check your custom plug-ins for compatibility and optionally have them made compatible before installing them in Enterprise Server 9.

Notes for the integrator

Check your plug-ins for usage of the following functions in the PluginInfo.php files:

  • isInstalled()
  • runInstallation()

If used, please refer to the following file for a description of the required changes for Enterprise 9.0 compatibility:

  • Enterprise/server/interfaces/plugins/EnterprisePlugin.class.php

In short, the file describes that the isInstalled() function should be removed and that for most cases you need to use a TestCase instead of using the runInstallation() function.

You can add your own TestCase to show up at the Health Check page. To do so, follow these steps:

Step 1. Create a file with the following name:

  • config/plugins/Foo/testsuite/HealthCheck2/Foo_TestCase.php

Step 2. Add the following code fragment to the file (assumed is that your plug-in is named Foo).

Note: Pay attention to the strong name convention for the folder name and class name: both require your plug-in name. By adding the TestCase it should automatically be picked up by the Health Check page.

require_once BASEDIR.'/server/wwtest/testsuite/TestSuiteInterfaces.php'; 
class WW_TestSuite_HealthCheck2_Foo_TestCase extends TestCase 
{ 
public function getDisplayName() { return '... your description ...'; } 
public function getTestGoals()   { return '... your description ...'; } 
public function getTestMethods() { return '... your description ...'; } 
public function getPrio()        { return 0; } 
 
final public function runTest() 
{ 
if( ... your condition ... ) { 
$this->setResult( 'ERROR', '... your error message ...' ); 
} 
} 
}

Test case modules

If you have TestCase modules shipped with your plug-in to show up on the Health Check page, it is no longer needed to check if your plug-in is enabled. Enterprise 9 does this for you automatically and therefore code fragments like the following can be removed from your TestCase modules:

// When plug-in is not installed or disabled, skip test and refer to the Server Plug-ins page to install/enable. 
$pluginObj = BizServerPlugin::getPluginForConnector( 'Foo' ); 
if( $pluginObj && $pluginObj->IsInstalled ) { 
if( !$pluginObj->IsActive ) { 
$this->setResult('NOTINSTALLED', 'The Foo plug-in is disabled.' ); 
return; 
} 
} else { 
$this->setResult('NOTINSTALLED', 'The Foo plug-in is not installed.' ); 
return; 
}

Automated test scripts

If you have an automated test script for you plug-in, you can enable your plug-in on-the-fly. After running the test, you can disable the plug-in again. For example:

final public function runTest() 
{ 
// Make sure the Foo plugin is active (enabled). 
require_once BASEDIR.'/server/utils/TestSuite.php'; 
$utils = new WW_Utils_TestSuite(); 
$didActivate = $utils->activatePluginByName( $this, 'Foo' ); 
if( is_null($didActivate) ) { // NULL indicates error. 
return; // Errors are already handled. 
} 
 
// Run the test. 
... 
 
// De-activate the Foo plugin again (but only when we did activate). 
if( $didActivate ) { 
$utils->deactivatePluginByName( $this, 'Foo' ); 
} 
}

Server enabled check

Checking wether a certain plug-in is enabled was previously done as follows:

if( BizServerPlugin::checkPluginInstalled( 'Foo_PubPublishing' ) ) { 
... 
} 

The checkPluginInstalled() function is no longer supported and therefore code fragments like above needs to be written as follows:

if( BizServerPlugin::isPluginActivated( 'Foo' ) ) { 
... 
} 

Note: The connector interface name (such as. PubPublishing) is no longer given. Pass in the plug-in name only.

Tip: The Enterprise/server/interfaces/plugins/EnterprisePlugin.class.php file describes 3 new functions and provides you with more control over the installation procedure of your plug-ins. Refer to the file for more information.

Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.