From: cajus Date: Wed, 31 May 2006 09:56:34 +0000 (+0000) Subject: Added option for plugins to stop delete process X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d51f17648ac98e9662589c759cd381d0afe513bd;p=gosa.git Added option for plugins to stop delete process git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3577 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 15180d73c..7ba3a4054 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -972,6 +972,14 @@ class plugin } + + /* Add possibility to stop remove process */ + function allow_remove() + { + $reason= ""; + return $reason; + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/include/class_tabs.inc b/include/class_tabs.inc index 689d89268..e0e8dbe42 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -175,6 +175,15 @@ class tabs function delete() { + /* Check if all plugins will ACK for deletion */ + foreach (array_reverse($this->by_object) as $key => $obj){ + $reason= $obj->allow_remove(); + if ($reason != ""){ + print_red(sprintf(_("Delete process has been canceled by plugin '%s': %s"), $key, $reason)); + return; + } + } + /* Delete for all plugins */ foreach (array_reverse($this->by_object) as $key => $obj){ $obj->remove_from_parent();