Skip to content

Commit cea6c00

Browse files
committed
Add 7.4 version entry DB migration
Signed-off-by: Riddhesh Sanghvi <[email protected]>
1 parent eb7eeb1 commit cea6c00

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace EE\Migration;
4+
5+
use EE;
6+
use EE\Model\Site;
7+
use EE\Migration\Base;
8+
9+
class UpdatePhpVersionEntry74 extends Base {
10+
11+
public function __construct() {
12+
13+
parent::__construct();
14+
$this->sites = Site::all();
15+
if ( $this->is_first_execution || ! $this->sites ) {
16+
$this->skip_this_migration = true;
17+
}
18+
}
19+
20+
/**
21+
* Execute create table query for site and sitemeta table.
22+
*
23+
* @throws EE\ExitException
24+
*/
25+
public function up() {
26+
27+
if ( $this->skip_this_migration ) {
28+
EE::debug( 'Skipping php-version migration as it is not needed.' );
29+
30+
return;
31+
}
32+
foreach ( $this->sites as $site ) {
33+
34+
if ( 'latest' === $site->php_version ) {
35+
$site->php_version = '7.4';
36+
$site->save();
37+
}
38+
}
39+
}
40+
41+
/**
42+
* No changes in case of down.
43+
*
44+
* @throws EE\ExitException
45+
*/
46+
public function down() {
47+
}
48+
49+
}

0 commit comments

Comments
 (0)