| 1 |
<?php |
| 2 |
|
| 3 |
namespace ImportWP\Common\Importer\State; |
| 4 |
|
| 5 |
use ImportWP\Common\Runner\RunnerState; |
| 6 |
|
| 7 |
class ImporterState extends RunnerState |
| 8 |
{ |
| 9 |
protected static $object_type = 'importer'; |
| 10 |
|
| 11 |
public function is_running() |
| 12 |
{ |
| 13 |
return $this->has_status('running'); |
| 14 |
} |
| 15 |
|
| 16 |
public function is_resumable() |
| 17 |
{ |
| 18 |
return $this->has_section(['import', 'delete', 'timeout']); |
| 19 |
} |
| 20 |
|
| 21 |
protected function default($session) |
| 22 |
{ |
| 23 |
return array_merge(parent::default($session), [ |
| 24 |
'section' => 'import', |
| 25 |
'progress' => [ |
| 26 |
'import' => [ |
| 27 |
'start' => 0, |
| 28 |
'end' => 0, |
| 29 |
'current_row' => 0, |
| 30 |
], |
| 31 |
'delete' => [ |
| 32 |
'start' => 0, |
| 33 |
'end' => 0, |
| 34 |
'current_row' => 0, |
| 35 |
] |
| 36 |
], |
| 37 |
]); |
| 38 |
} |
| 39 |
} |
| 40 |
|