| Conditions | 8 |
| Paths | 3 |
| Total Lines | 34 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php defined('SYSPATH') OR die('No direct script access.'); |
||
| 13 | protected function _execute(array $options) |
||
| 14 | { |
||
| 15 | $executed = $this->executed_migrations(); |
||
| 16 | $unexecuted = $this->unexecuted_migrations(); |
||
| 17 | $all = $this->all_migrations(); |
||
| 18 | |||
| 19 | $up = array(); |
||
| 20 | $down = array(); |
||
| 21 | |||
| 22 | if ($options['version']) |
||
| 23 | { |
||
| 24 | foreach ($all as $migration) |
||
| 25 | { |
||
| 26 | if ( ! in_array($migration, $executed) AND $migration <= $options['version']) |
||
| 27 | { |
||
| 28 | $up[] = $migration; |
||
| 29 | } |
||
| 30 | if (in_array($migration, $executed) AND $migration > $options['version']) |
||
| 31 | { |
||
| 32 | $down[] = $migration; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | elseif ($options['steps']) |
||
| 37 | { |
||
| 38 | $up = array_slice($unexecuted, 0, $options['steps']); |
||
| 39 | } |
||
| 40 | else |
||
| 41 | { |
||
| 42 | $up = $unexecuted; |
||
| 43 | } |
||
| 44 | |||
| 45 | $this->migrate($up, $down, $options['dry-run'] === NULL); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |