| |
1 |
1 |
ad_page_contract { |
| |
2 |
2 |
This deletes a type with all subtypes and instances |
| |
3 |
3 |
|
| |
4 |
4 |
@author Your Name (you@example.com) |
| |
5 |
5 |
@cvs-id $Id$ |
| |
6 |
6 |
|
| |
7 |
7 |
@param object_type the class name of an instance of CrClass |
| |
8 |
8 |
} -query { |
| |
9 |
9 |
object_type |
| |
10 |
10 |
{query "."} |
| |
11 |
11 |
} |
| |
12 |
12 |
|
| |
13 |
|
db_foreach retrieve_instances [$object_type instance_select_query] { |
| |
|
13 |
set p [::xowiki::Package create ::[ad_conn package_id]] |
| |
|
14 |
|
| |
|
15 |
db_foreach retrieve_instances [$object_type instance_select_query -folder_id [$p set folder_id]] { |
| |
14 |
16 |
permission::require_write_permission -object_id $item_id |
| |
15 |
17 |
$object_type delete -item_id $item_id |
| |
16 |
18 |
} |
| |
17 |
19 |
|
| |
18 |
20 |
# drop type requires that all pages of all xowiki instances are deleted |
| |
19 |
21 |
#foreach type [$object_type object_types -subtypes_first true] {$type drop_object_type} |
| |
20 |
22 |
|
| |
21 |
23 |
ad_returnredirect $query |