KMP-4: - Retrieve the zpush version from the About() service request and show it in the settings

This commit is contained in:
Ronald Toussaint
2016-12-07 11:48:14 +01:00
parent 7385ef179e
commit d610e9e181
3 changed files with 64 additions and 11 deletions

View File

@ -9,6 +9,9 @@ class PluginMDM extends Plugin {
*/
function init(){
$this->registerHook('server.core.settings.init.before');
// This hook is used to add the Z-Push server version to the settings
$this->registerHook('server.index.load.main.before');
}
/**
@ -21,11 +24,14 @@ class PluginMDM extends Plugin {
case 'server.core.settings.init.before':
$this->onBeforeSettingsInit($data);
break;
case 'server.index.load.main.before':
$this->addZPushVersionToSettings();
break;
}
}
/**
* Called when the core Settings class is initialized and ready to accept sysadmin default
* Called when the core Settings class is initialized and ready to accept sysadmin default
* settings. Registers the sysadmin defaults for the StatsLogging plugin.
* @param Array $data Reference to the data of the triggered hook
*/
@ -42,5 +48,19 @@ class PluginMDM extends Plugin {
)
));
}
/**
* Adds the version of the z-push server to the MDM settings
*/
function addZPushVersionToSettings(){
// This is a bit ugly, but since all z-push logic was put in the MDM module class,
// we have added the getServerVersion function there also
require_once(BASE_PATH . 'server/includes/modules/class.module.php');
require_once('class.pluginmdmmodule.php');
$module = new PluginMDMModule('fakeid', array());
$version = $module->getServerVersion();
$GLOBALS['settings']->set("zarafa/v1/plugins/mdm/zpush-server-version", $version);
}
}
?>