Conditions | 3 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
3 | function es_doc_delete($request, $args) { |
||
1 ignored issue
–
show
|
|||
4 | |||
5 | global $ES; |
||
6 | |||
7 | $index = $args['index']; |
||
8 | $type = $args['type']; |
||
9 | $id = $args['id']; |
||
10 | $params = []; |
||
11 | $params['index'] = $index; |
||
12 | $params['type'] = $type; |
||
13 | $params['id'] = $id; |
||
14 | try { |
||
15 | $result = $ES->delete($params); |
||
16 | } catch (Exception $e) { |
||
17 | /* |
||
18 | If you try to delete a document with an _id that does not exist, $ES->delete throws an Exception. |
||
19 | B/c of default behaviour of reformo/rslim, it bypasses all Exceptions and it returns Exception message. |
||
20 | In this case it returns this message as a plain text json that elasticsearch-php returns. |
||
21 | */ |
||
22 | $result = json_decode($e->getMessage(), true); |
||
23 | } |
||
24 | $found = ($result['found'] === true) ? 1 : 0; |
||
25 | sleep(1); |
||
26 | header("location:" . BASE_HREF . "/" . $index . "/" . $type . "?res=success&req=delete&f=".$found); |
||
27 | exit; |
||
28 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.