-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #435 from mrrobot47/update/7.4-db-migration
Add 7.4 version entry DB migration
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
migrations/db/20240512115131_site-command_update_php_version_entry_74.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace EE\Migration; | ||
|
||
use EE; | ||
use EE\Model\Site; | ||
use EE\Migration\Base; | ||
|
||
class UpdatePhpVersionEntry74 extends Base { | ||
|
||
public function __construct() { | ||
|
||
parent::__construct(); | ||
$this->sites = Site::all(); | ||
if ( $this->is_first_execution || ! $this->sites ) { | ||
$this->skip_this_migration = true; | ||
} | ||
} | ||
|
||
/** | ||
* Execute create table query for site and sitemeta table. | ||
* | ||
* @throws EE\ExitException | ||
*/ | ||
public function up() { | ||
|
||
if ( $this->skip_this_migration ) { | ||
EE::debug( 'Skipping php-version migration as it is not needed.' ); | ||
|
||
return; | ||
} | ||
foreach ( $this->sites as $site ) { | ||
|
||
if ( 'latest' === $site->php_version ) { | ||
$site->php_version = '7.4'; | ||
$site->save(); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* No changes in case of down. | ||
* | ||
* @throws EE\ExitException | ||
*/ | ||
public function down() { | ||
} | ||
|
||
} |