Conditions | 7 |
Paths | 24 |
Total Lines | 39 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 7.0099 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | 27 | public function run(Client $client, Filesystem $fs) |
|
13 | { |
||
14 | 27 | $space = $client->getSpace('_vspace'); |
|
15 | |||
16 | 27 | $client->evaluate(" |
|
17 | if box.space._queue ~= nil then |
||
18 | if queue == nil then |
||
19 | queue = require('queue') |
||
20 | end |
||
21 | for i, q in box.space._queue:pairs() do |
||
22 | queue.tube[q.tube_name]:drop() |
||
23 | end |
||
24 | end |
||
25 | "); |
||
26 | |||
27 | 27 | $response = $space->select([], Index::SPACE_NAME); |
|
28 | 27 | $data = $response->getData(); |
|
29 | |||
30 | 27 | foreach ($data as $row) { |
|
31 | 27 | if ($row[1] == 0) { |
|
32 | // user space |
||
33 | 27 | if (strpos($row[2], '_queue') === false) { |
|
34 | 27 | $client->evaluate('box.space.'.$row[2].':drop()'); |
|
35 | } |
||
36 | } |
||
37 | } |
||
38 | |||
39 | 27 | $schema = $client->getSpace('_schema')->select([], 0)->getData(); |
|
40 | 27 | foreach ($schema as $tuple) { |
|
41 | 27 | if (strpos($tuple[0], 'mapper-once') === 0) { |
|
42 | 27 | $client->getSpace('_schema')->delete([$tuple[0]]); |
|
43 | } |
||
44 | } |
||
45 | |||
46 | 27 | $filename = $fs->getPath('.cache/mapper-meta.php'); |
|
47 | 27 | if (file_exists($filename)) { |
|
48 | unlink($filename); |
||
49 | } |
||
50 | 27 | } |
|
51 | } |
||
52 |