PluginProbe
WP-Stateless – Google Cloud Storage / trunk
WP-Stateless – Google Cloud Storage vtrunk
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
wp-stateless / lib / classes / batch / class-migration.php

class-migration.php in WP-Stateless – Google Cloud Storage trunk, at lib/classes/batch/class-migration.php

38 lines 724 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Batch Task
4 *
5 * @since 4.0.0
6 */
7
8 namespace wpCloud\StatelessMedia\Batch;
9
10 abstract class Migration extends BatchTask {
11 // Indicates whether we should stop querying new items
12 protected $stop = false;
13
14 public function get_state() {
15 $state = parent::get_state();
16
17 $state['id'] = $this->id;
18 $state['is_migration'] = true;
19 $state['stop'] = $this->stop;
20
21 return $state;
22 }
23
24 public function set_state($state) {
25 parent::set_state($state);
26
27 $this->stop = $state['stop'] ?? false;
28 }
29
30 /**
31 * Can be used to test if the migration should run
32 * For example, if there are any old data that needs to be migrated
33 */
34 public function should_run() {
35 return true;
36 }
37 }
38