Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
19 | public function execute() |
||
20 | { |
||
21 | $qb = midcom_services_at_entry_dba::new_query_builder(); |
||
22 | // (to be) start(ed) AND last touched over two days ago |
||
23 | $qb->add_constraint('start', '<=', time() - 3600 * 24 * 2); |
||
24 | $qb->add_constraint('metadata.revised', '<=', date('Y-m-d H:i:s', time() - 3600 * 24 * 2)); |
||
25 | $qb->add_constraint('status', '>=', midcom_services_at_entry_dba::RUNNING); |
||
26 | |||
27 | midcom::get()->auth->request_sudo($this->_component); |
||
28 | foreach ($qb->execute() as $entry) { |
||
29 | debug_add("Deleting dangling entry #{$entry->id}\n", MIDCOM_LOG_INFO); |
||
30 | debug_print_r("Entry #{$entry->id} dump: ", $entry); |
||
31 | $entry->delete(); |
||
32 | } |
||
33 | midcom::get()->auth->drop_sudo(); |
||
34 | } |
||
36 |