File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ function os2web_cp_service_drush_command() {
15
15
'arguments ' => array (),
16
16
'aliases ' => array ('cp-up ' ),
17
17
);
18
+ $ items ['cp-cleanup ' ] = array (
19
+ 'description ' => 'Delete all refenreces which are broken to a Stub. ' ,
20
+ 'arguments ' => array (),
21
+ 'aliases ' => array ('cp-cl ' ),
22
+ );
18
23
return $ items ;
19
24
}
20
25
@@ -53,3 +58,23 @@ function drush_os2web_cp_service_cp_update_ref() {
53
58
}
54
59
}
55
60
}
61
+
62
+ /**
63
+ * Implements drush_COMMAND().
64
+ */
65
+ function drush_os2web_cp_service_cp_cleanup () {
66
+
67
+ $ nodes = db_query ("SELECT *
68
+ FROM node n
69
+ WHERE n.type = 'os2web_cp_service_cp_document'
70
+ AND n.title = 'Stub'
71
+ AND n.nid IN (
72
+ SELECT field_os2web_cp_service_doc_ref_target_id
73
+ FROM field_data_field_os2web_cp_service_doc_ref
74
+ ) " );
75
+
76
+ foreach ($ nodes as $ node ) {
77
+ node_delete (nid);
78
+ drush_log (t ('Deleted stub: :node ' , array (':node ' => $ node ->nid )), 'success ' );
79
+ }
80
+ }
You can’t perform that action at this time.
0 commit comments