class-wpml-upgrade-table-translate-job-for-3-9-0.php
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
class WPML_Upgrade_Table_Translate_Job_For_3_9_0 implements IWPML_Upgrade_Command {
/** @var bool $result */
private $result = true;
/** @var WPML_Upgrade_Schema */
private $upgrade_schema;
public function __construct( array $args ) {
$this->upgrade_schema = $args[0];
}
/** @return bool */
private function run() {
$table = 'icl_translate_job';
$columns = array(
'title' => 'VARCHAR(160) NULL',
'deadline_date' => 'DATETIME NULL',
'completed_date' => 'DATETIME NULL',
);
if ( $this->upgrade_schema->does_table_exist( $table ) ) {
foreach ( $columns as $column => $attribute_string ) {
if ( ! $this->upgrade_schema->does_column_exist( $table, $column ) ) {
$this->upgrade_schema->add_column( $table, $column, $attribute_string );
}
}
}
return $this->result;
}
public function run_admin() {
return $this->run();
}
public function run_ajax() {
return $this->run();
}
public function run_frontend() {
return $this->run();
}
/** @return bool */
public function get_results() {
return $this->result;
}
}