? system_service_module_exists.patch
Index: system_service.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/services/system_service/Attic/system_service.module,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 system_service.module
--- system_service.module	25 Jan 2008 02:52:22 -0000	1.2.2.1
+++ system_service.module	26 Mar 2008 15:22:38 -0000
@@ -102,6 +102,20 @@ function system_service_service() {
         ),
       ),
       '#help'     => t('Set a persistent variable.')),
+
+    // system.moduleExists
+    array(
+      '#method'   => 'system.moduleExists',
+      '#callback' => 'system_service_module_exists',
+      '#args'     => array(
+        array(
+          '#name'         => 'module',
+          '#type'         => 'string',
+          '#description'  => t('The name of the module.')
+        ),
+      ),
+      '#return'   => 'string',
+      '#help'     => t('Check if a module is enabled. If so, return its version.')),
   );
 }
 
@@ -143,3 +157,18 @@ function system_service_getvariable($nam
 function system_service_setvariable($name, $value) {
   variable_set($name, $value);
 }
+
+/**
+ * Check if a module is enabled. If so, return its version.
+ */
+function system_service_module_exists($module) {
+  if (module_exists($module)) {
+    $modules = module_rebuild_cache();
+    if (array_key_exists($module, $modules)) {
+      return (string)$modules[$module]->info['version'];  
+    }    
+  }
+  
+  return "";
+}
+
