| Conditions | 2 |
| Paths | 2 |
| Total Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function start(): bool |
||
| 37 | { |
||
| 38 | $cursor = $this->db->storage->aggregate([ |
||
| 39 | ['$unwind' => '$history'], |
||
| 40 | ['$match' => [ |
||
| 41 | '$or' => [ |
||
| 42 | ['history.storage_reference' => ['$exists' => 1]], |
||
| 43 | ['history.storage_adapter' => ['$exists' => 1]], |
||
| 44 | ], |
||
| 45 | ]], |
||
| 46 | ]); |
||
| 47 | |||
| 48 | foreach ($cursor as $object) { |
||
| 49 | $this->db->storage->updateOne( |
||
| 50 | [ |
||
| 51 | '_id' => $object['_id'], |
||
| 52 | 'history.version' => $object['history']['version'], |
||
| 53 | ], |
||
| 54 | [ |
||
| 55 | '$unset' => [ |
||
| 56 | 'history.$.storage_adapter' => true, |
||
| 57 | 'history.$.storage_reference' => true, |
||
| 58 | ], |
||
| 59 | ] |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | |||
| 63 | return true; |
||
| 64 | } |
||
| 65 | } |
||
| 66 |