ftimme
2012-11-12 8e38755040c6c2073f92f0ffb087da530d0e7a0a
server/mods-available/database_module.inc.php
@@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -34,8 +34,24 @@
   var $class_name = 'database_module';
   var $actions_available = array(   'database_insert',
                           'database_update',
                           'database_delete'
                           'database_delete',
                           'database_user_insert',
                           'database_user_update',
                           'database_user_delete'
                           );
   //* This function is called during ispconfig installation to determine
   //  if a symlink shall be created for this plugin.
   function onInstall() {
      global $conf;
      if($conf['services']['db'] == true) {
         return true;
      } else {
         return false;
      }
   }
   
   /*
       This function is called when the module is loaded
@@ -61,7 +77,8 @@
       class that contains the function functionname.
      */
      
      $app->modules->registerTableHook('web_database','server_module','process');
      $app->modules->registerTableHook('web_database','database_module','process');
      $app->modules->registerTableHook('web_database_user','database_module','process');
      
      // Register service
      //$app->services->registerService('httpd','web_module','restartHttpd');
@@ -82,6 +99,13 @@
            if($action == 'u') $app->plugins->raiseEvent('database_update',$data);
            if($action == 'd') $app->plugins->raiseEvent('database_delete',$data);
         break;
         case 'web_database_user':
            if($action == 'i') $app->plugins->raiseEvent('database_user_insert',$data);
            if($action == 'u') $app->plugins->raiseEvent('database_user_update',$data);
            if($action == 'd') $app->plugins->raiseEvent('database_user_delete',$data);
         break;
      } // end switch
   } // end function