File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments