Skip to content

Commit

Permalink
Merge pull request #435 from mrrobot47/update/7.4-db-migration
Browse files Browse the repository at this point in the history
Add 7.4 version entry DB migration
  • Loading branch information
mrrobot47 committed May 13, 2024
2 parents eb7eeb1 + cea6c00 commit b234955
Showing 1 changed file with 49 additions and 0 deletions.
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() {
}

}

0 comments on commit b234955

Please sign in to comment.