From 2cb1563f63386b35a69e460051aa9b4a2851d104 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Wed, 30 May 2012 07:30:44 -0400
Subject: [PATCH] - Added (clickable) placeholders to client messaging function. - Added check so that the client password isn't inserted into the message (for security reasons).

---
 server/mods-available/web_module.inc.php |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index 653940f..8d5681a 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -49,7 +49,10 @@
 									'web_folder_delete',
 									'web_folder_user_insert',
 									'web_folder_user_update',
-									'web_folder_user_delete');
+									'web_folder_user_delete',
+									'web_backup_insert',
+									'web_backup_update',
+									'web_backup_delete');
 	
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
@@ -94,9 +97,11 @@
 		$app->modules->registerTableHook('webdav_user','web_module','process');
 		$app->modules->registerTableHook('web_folder','web_module','process');
 		$app->modules->registerTableHook('web_folder_user','web_module','process');
+		$app->modules->registerTableHook('web_backup','web_module','process');
 		
 		// Register service
 		$app->services->registerService('httpd','web_module','restartHttpd');
+		$app->services->registerService('php-fpm','web_module','restartPHP_FPM');
 		
 	}
 	
@@ -139,6 +144,11 @@
 				if($action == 'u') $app->plugins->raiseEvent('web_folder_user_update',$data);
 				if($action == 'd') $app->plugins->raiseEvent('web_folder_user_delete',$data);
 			break;
+			case 'web_backup':
+				if($action == 'i') $app->plugins->raiseEvent('web_backup_insert',$data);
+				if($action == 'u') $app->plugins->raiseEvent('web_backup_update',$data);
+				if($action == 'd') $app->plugins->raiseEvent('web_backup_delete',$data);
+			break;
 		} // end switch
 	} // end function
 	
@@ -155,9 +165,6 @@
 		switch ($web_config['server_type']) {
 			case 'nginx':
 				$daemon = $web_config['server_type'];
-				// Reload PHP-FPM as well
-				$restart_second_service['daemon'] = $web_config['php_fpm_init_script'];
-				$restart_second_service['action'] = 'reload';
 				break;
 			default:
 				if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
@@ -166,11 +173,7 @@
 					$daemon = 'apache2';
 				}
 		}
-		
-		if($restart_second_service['daemon'] != '' && $restart_second_service['action'] != ''){
-			exec($conf['init_scripts'] . '/' . $restart_second_service['daemon'] . ' ' . $restart_second_service['action']);
-		}
-		
+
 		if($action == 'restart') {
 			exec($conf['init_scripts'] . '/' . $daemon . ' restart');
 		} else {
@@ -178,6 +181,20 @@
 		}
 		
 	}
+	
+	function restartPHP_FPM($action = 'restart') {
+		global $app,$conf;
+		
+		// load the server configuration options
+		$app->uses('getconf');
+		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+		
+		list($action, $init_script) = explode(':', $action);
+		
+		if(!$init_script) $init_script = $conf['init_scripts'].'/'.$web_config['php_fpm_init_script'];
+		
+		exec($init_script.' '.$action);
+	}
 
 } // end class
 

--
Gitblit v1.9.1