Skip to content

Commit

Permalink
fix: Update defaults for config overrides (ddev#6058)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay authored Apr 5, 2024
1 parent 9ec938c commit e8e62aa
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 23 deletions.
6 changes: 2 additions & 4 deletions pkg/ddevapp/apptypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ func init() {
},

nodeps.AppTypeLaravel: {
appTypeDetect: isLaravelApp,
postStartAction: laravelPostStartAction,
configOverrideAction: laravelConfigOverrideAction,
appTypeDetect: isLaravelApp,
postStartAction: laravelPostStartAction,
},

nodeps.AppTypeSilverstripe: {
Expand All @@ -168,7 +167,6 @@ func init() {
uploadDirs: getMagentoUploadDirs,
appTypeSettingsPaths: setMagentoSiteSettingsPaths,
appTypeDetect: isMagentoApp,
configOverrideAction: magentoConfigOverrideAction,
importFilesAction: magentoImportFilesAction,
},

Expand Down
6 changes: 3 additions & 3 deletions pkg/ddevapp/apptypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ func TestConfigOverrideAction(t *testing.T) {
nodeps.AppTypeDrupal7: nodeps.PHP82,
nodeps.AppTypeDrupal: nodeps.PHPDefault,
nodeps.AppTypeLaravel: nodeps.PHP82,
nodeps.AppTypeMagento: nodeps.PHP74,
nodeps.AppTypeMagento2: nodeps.PHP81,
nodeps.AppTypeMagento: nodeps.PHPDefault,
nodeps.AppTypeMagento2: nodeps.PHP82,
nodeps.AppTypeSilverstripe: nodeps.PHPDefault,
nodeps.AppTypeWordPress: nodeps.PHPDefault,
nodeps.AppTypeSilverstripe: nodeps.PHP81,
}

for appType, expectedPHPVersion := range appTypes {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddevapp/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func TestConfigCommand(t *testing.T) {
const apptypePos = 0
const phpVersionPos = 1
testMatrix := map[string][]string{
"magentophpversion": {nodeps.AppTypeMagento, nodeps.PHP74},
"magentophpversion": {nodeps.AppTypeMagento, nodeps.PHPDefault},
"drupal7phpversion": {nodeps.AppTypeDrupal7, nodeps.PHP82},
"drupalphpversion": {nodeps.AppTypeDrupal, nodeps.PHPDefault},
}
Expand Down
1 change: 0 additions & 1 deletion pkg/ddevapp/drupal.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ func drupalConfigOverrideAction(app *DdevApp) error {
app.Database = DatabaseDesc{Type: nodeps.MariaDB, Version: nodeps.MariaDB104}
case "9":
app.PHPVersion = nodeps.PHP81
app.Database = DatabaseDesc{Type: nodeps.MariaDB, Version: nodeps.MariaDB104}
case "10":
app.PHPVersion = nodeps.PHP83
case "11":
Expand Down
11 changes: 6 additions & 5 deletions pkg/ddevapp/laravel.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ func laravelPostStartAction(app *DdevApp) error {
return nil
}

// laravelConfigOverrideAction overrides php_version for Laravel, requires PHP8.2
func laravelConfigOverrideAction(app *DdevApp) error {
app.PHPVersion = nodeps.PHP82
return nil
}
// laravelConfigOverrideAction would require PHP8.2
// but that is now the default for DDEV v1.23+
//func laravelConfigOverrideAction(app *DdevApp) error {
// app.PHPVersion = nodeps.PHP82
// return nil
//}
13 changes: 8 additions & 5 deletions pkg/ddevapp/magento.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,18 @@ func setMagento2SiteSettingsPaths(app *DdevApp) {
app.SiteSettingsPath = filepath.Join(app.AppRoot, app.Docroot, "..", "app", "etc", "env.php")
}

func magentoConfigOverrideAction(app *DdevApp) error {
app.PHPVersion = nodeps.PHP74
return nil
}
// magentoConfigOverrideAction is not currently required
// as OpenMage allows PHP up to 8.3
// See https://github.com/OpenMage/magento-lts#requirements
//func magentoConfigOverrideAction(app *DdevApp) error {
// app.PHPVersion = nodeps.PHP74
// return nil
//}

// Magento2 2.4.6 requires php8.1/2 and MariaDB 10.6
// https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html
func magento2ConfigOverrideAction(app *DdevApp) error {
app.PHPVersion = nodeps.PHP81
app.PHPVersion = nodeps.PHP82
app.Database = DatabaseDesc{Type: nodeps.MariaDB, Version: nodeps.MariaDB106}
return nil
}
6 changes: 2 additions & 4 deletions pkg/ddevapp/silverstripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ func getSilverstripeUploadDirs(_ *DdevApp) []string {
return uploadDirs
}

// silverstripeConfigOverrideAction overrides php_version for Silverstripe, requires PHP8.1
// silverstripeConfigOverrideAction: Silverstripe prefers Apache
// https://docs.silverstripe.org/en/5/getting_started/#server-requirements
func silverstripeConfigOverrideAction(app *DdevApp) error {
app.PHPVersion = nodeps.PHP81
app.WebserverType = nodeps.WebserverApacheFPM
app.Database.Type = nodeps.MariaDB
app.Database.Version = nodeps.MariaDB104
return nil
}

0 comments on commit e8e62aa

Please sign in to comment.