MCPcopy Index your code
hub / github.com/ddev/ddev / drupalPostStartAction

Function drupalPostStartAction

pkg/ddevapp/drupal.go:465–507  ·  view source on GitHub ↗
(app *DdevApp)

Source from the content-addressed store, hash-verified

463}
464
465func drupalPostStartAction(app *DdevApp) error {
466 if !nodeps.ArrayContainsString(app.GetOmittedContainers(), "db") && (isDrupalApp(app)) {
467 err := app.Wait([]string{nodeps.DBContainer})
468 if err != nil {
469 return err
470 }
471 // pg_trm extension is required in Drupal9.5+
472 if app.Database.Type == nodeps.Postgres {
473 stdout, stderr, err := app.Exec(&ExecOpts{
474 Service: "db",
475 Cmd: `psql -q -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" 2>/dev/null`,
476 NoCapture: false,
477 })
478 if err != nil {
479 util.Warning("unable to CREATE EXTENSION pg_trm: stdout='%s', stderr='%s', err=%v", stdout, stderr, err)
480 }
481 }
482 // SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED required in Drupal 9.5+
483 if app.Database.Type == nodeps.MariaDB || app.Database.Type == nodeps.MySQL {
484 _, _, err := app.Exec(&ExecOpts{
485 Service: "db",
486 Cmd: fmt.Sprintf(`%s -uroot -proot -e "SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;" >/dev/null 2>&1`, app.GetDBClientCommand()),
487 NoCapture: false,
488 })
489 if err != nil {
490 util.Warning("Unable to SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED: %v", err)
491 }
492 }
493 }
494 // Return early because we aren't expected to manage settings.
495 if app.DisableSettingsManagement {
496 return nil
497 }
498 if err := createDrupal8SyncDir(app); err != nil {
499 return err
500 }
501
502 //nolint: revive
503 if err := drupalEnsureWritePerms(app); err != nil {
504 return err
505 }
506 return nil
507}
508
509// drupal7PostStartAction handles default post-start actions for D7 apps, like ensuring
510// useful permissions settings on sites/default.

Callers

nothing calls this directly

Calls 9

ArrayContainsStringFunction · 0.92
WarningFunction · 0.92
isDrupalAppFunction · 0.85
createDrupal8SyncDirFunction · 0.85
drupalEnsureWritePermsFunction · 0.85
GetOmittedContainersMethod · 0.80
WaitMethod · 0.80
ExecMethod · 0.80
GetDBClientCommandMethod · 0.80

Tested by

no test coverage detected