tbrehm
2011-09-07 c719dc0b1dd696e0cd6b51f09ee13c8263375f7c
server/mods-available/web_module.inc.php
@@ -40,7 +40,23 @@
                           'ftp_user_delete',
                           'shell_user_insert',
                           'shell_user_update',
                           'shell_user_delete');
                           'shell_user_delete',
                           'webdav_user_insert',
                           'webdav_user_update',
                           'webdav_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']['web'] == true) {
         return true;
      } else {
         return false;
      }
   }
   
   /*
       This function is called when the module is loaded
@@ -67,7 +83,9 @@
      */
      
      $app->modules->registerTableHook('web_domain','web_module','process');
      $app->modules->registerTableHook('ftp_user','web_module','process');
      $app->modules->registerTableHook('shell_user','web_module','process');
      $app->modules->registerTableHook('webdav_user','web_module','process');
      
      // Register service
      $app->services->registerService('httpd','web_module','restartHttpd');
@@ -98,29 +116,34 @@
            if($action == 'u') $app->plugins->raiseEvent('shell_user_update',$data);
            if($action == 'd') $app->plugins->raiseEvent('shell_user_delete',$data);
         break;
         case 'webdav_user':
            if($action == 'i') $app->plugins->raiseEvent('webdav_user_insert',$data);
            if($action == 'u') $app->plugins->raiseEvent('webdav_user_update',$data);
            if($action == 'd') $app->plugins->raiseEvent('webdav_user_delete',$data);
         break;
      } // end switch
   } // end function
   
   
   // This function is used
   function restartHttpd($action = 'restart') {
      global $app;
      global $app,$conf;
      
      $command = '';
      if(is_file('/etc/init.d/httpd')) {
         $command = '/etc/init.d/httpd';
      $daemon = '';
      if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
         $daemon = 'httpd';
      } else {
         $command = '/etc/init.d/apache2';
         $daemon = 'apache2';
      }
      
      if($action == 'restart') {
         exec($command.' restart');
         exec($conf['init_scripts'] . '/' . $daemon . ' restart');
      } else {
         exec($command.' reload');
         exec($conf['init_scripts'] . '/' . $daemon . ' reload');
      }
      
   }
} // end class
?>
?>