diff options
author | CasperW | 2009-11-26 15:17:44 +0100 |
---|---|---|
committer | CasperW | 2009-11-26 15:17:44 +0100 |
commit | ac2fcbe224d4877dccc4d73e9c58771e40a4ae1c (patch) | |
tree | 0a3b8af2b488d06dab952322bd46b2157cd8838a /OpenSim/ApplicationPlugins | |
parent | Added animation support for my last commit (diff) | |
download | opensim-SC_OLD-ac2fcbe224d4877dccc4d73e9c58771e40a4ae1c.zip opensim-SC_OLD-ac2fcbe224d4877dccc4d73e9c58771e40a4ae1c.tar.gz opensim-SC_OLD-ac2fcbe224d4877dccc4d73e9c58771e40a4ae1c.tar.bz2 opensim-SC_OLD-ac2fcbe224d4877dccc4d73e9c58771e40a4ae1c.tar.xz |
Improvements to rAdmin admin_shutdown and admin_restart. Both methods can now accept a parameter of noticetype = dialog in order to display a blue persistant dropdown instead of a short notice. Added an optional and configurable delay to the restart method, defaulting at 30 seconds as before. Both methods can also accept a noticetype = none dialog in order to act silently.
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 74 |
1 files changed, 72 insertions, 2 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3bc557d..325816d 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -213,9 +213,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
213 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) | 213 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) |
214 | throw new Exception("region not found"); | 214 | throw new Exception("region not found"); |
215 | 215 | ||
216 | int timeout = 30000; | ||
217 | string message; | ||
218 | |||
219 | if (requestData.ContainsKey("restart") | ||
220 | && ((string)requestData["restart"] == "delayed") | ||
221 | && requestData.ContainsKey("milliseconds")) | ||
222 | { | ||
223 | timeout = Int32.Parse(requestData["milliseconds"].ToString()); | ||
224 | |||
225 | if (timeout < 15000) | ||
226 | { | ||
227 | //It must be at least 15 seconds or we'll cancel the reboot request | ||
228 | timeout = 15000; | ||
229 | } | ||
230 | |||
231 | message | ||
232 | = "Region is restarting in " + ((int)(timeout / 1000)).ToString() | ||
233 | + " second(s). Please save what you are doing and log out."; | ||
234 | } | ||
235 | else | ||
236 | { | ||
237 | message = "Region is restarting in 30 second(s). Please save what you are doing and log out."; | ||
238 | } | ||
239 | |||
240 | if (requestData.ContainsKey("noticetype") | ||
241 | && ((string)requestData["noticetype"] == "dialog")) | ||
242 | { | ||
243 | m_app.SceneManager.ForEachScene( | ||
244 | delegate(Scene scene) | ||
245 | { | ||
246 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
247 | if (dialogModule != null) | ||
248 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); | ||
249 | }); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | if (!requestData.ContainsKey("noticetype") | ||
254 | || ((string)requestData["noticetype"] != "none")) | ||
255 | { | ||
256 | m_app.SceneManager.ForEachScene( | ||
257 | delegate(Scene scene) | ||
258 | { | ||
259 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
260 | if (dialogModule != null) | ||
261 | dialogModule.SendGeneralAlert(message); | ||
262 | }); | ||
263 | } | ||
264 | } | ||
265 | |||
216 | responseData["rebooting"] = true; | 266 | responseData["rebooting"] = true; |
217 | response.Value = responseData; | 267 | response.Value = responseData; |
218 | rebootedScene.Restart(30); | 268 | rebootedScene.Restart(timeout / 1000,false); |
219 | } | 269 | } |
220 | catch (Exception e) | 270 | catch (Exception e) |
221 | { | 271 | { |
@@ -419,13 +469,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
419 | message = "Region is going down now."; | 469 | message = "Region is going down now."; |
420 | } | 470 | } |
421 | 471 | ||
422 | m_app.SceneManager.ForEachScene( | 472 | if (requestData.ContainsKey("noticetype") |
473 | && ((string) requestData["noticetype"] == "dialog")) | ||
474 | { | ||
475 | m_app.SceneManager.ForEachScene( | ||
423 | delegate(Scene scene) | 476 | delegate(Scene scene) |
424 | { | 477 | { |
425 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 478 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
426 | if (dialogModule != null) | 479 | if (dialogModule != null) |
480 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); | ||
481 | }); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | if (!requestData.ContainsKey("noticetype") | ||
486 | || ((string)requestData["noticetype"] != "none")) | ||
487 | { | ||
488 | m_app.SceneManager.ForEachScene( | ||
489 | delegate(Scene scene) | ||
490 | { | ||
491 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
492 | if (dialogModule != null) | ||
427 | dialogModule.SendGeneralAlert(message); | 493 | dialogModule.SendGeneralAlert(message); |
428 | }); | 494 | }); |
495 | } | ||
496 | } | ||
497 | |||
498 | |||
429 | 499 | ||
430 | // Perform shutdown | 500 | // Perform shutdown |
431 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing | 501 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing |