Conditions | 4 |
Paths | 5 |
Total Lines | 34 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4.1755 |
Changes | 0 |
1 | <?php |
||
28 | 1 | public function run() |
|
29 | { |
||
30 | 1 | global $modSettings; |
|
31 | |||
32 | 1 | if (empty($modSettings['enableFollowup'])) |
|
33 | 1 | return false; |
|
34 | |||
35 | 1 | $db = database(); |
|
36 | |||
37 | // The old FU request :P |
||
38 | 1 | $request = $db->query('', ' |
|
39 | SELECT |
||
40 | fu.derived_from |
||
41 | FROM {db_prefix}follow_ups AS fu |
||
42 | LEFT JOIN {db_prefix}messages AS m ON (fu.derived_from = m.id_msg) |
||
43 | WHERE m.id_msg IS NULL |
||
44 | 1 | LIMIT {int:limit}', |
|
45 | array( |
||
46 | 1 | 'limit' => 100, |
|
47 | ) |
||
48 | 1 | ); |
|
49 | 1 | $remove = array(); |
|
50 | 1 | while ($row = $db->fetch_assoc($request)) |
|
51 | $remove[] = $row['derived_from']; |
||
52 | 1 | $db->free_result($request); |
|
53 | |||
54 | 1 | if (empty($remove)) |
|
55 | 1 | return true; |
|
56 | |||
57 | require_once(SUBSDIR . '/FollowUps.subs.php'); |
||
58 | removeFollowUpsByMessage($remove); |
||
59 | |||
60 | return true; |
||
61 | } |
||
62 | } |