DetectAppType calls each apptype's detector until it finds a match, or returns 'php' as a last resort.
()
| 438 | // DetectAppType calls each apptype's detector until it finds a match, |
| 439 | // or returns 'php' as a last resort. |
| 440 | func (app *DdevApp) DetectAppType() string { |
| 441 | // `generic` type should not be overridden |
| 442 | if app.Type == nodeps.AppTypeGeneric { |
| 443 | return app.Type |
| 444 | } |
| 445 | var keys []string |
| 446 | for k := range appTypeMatrix { |
| 447 | keys = append(keys, k) |
| 448 | } |
| 449 | sort.Strings(keys) |
| 450 | |
| 451 | // Traverse in sorted order |
| 452 | for _, appTypeName := range keys { |
| 453 | appFuncs := appTypeMatrix[appTypeName] |
| 454 | if appFuncs.appTypeDetect != nil && appFuncs.appTypeDetect(app) { |
| 455 | return appTypeName |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | return nodeps.AppTypePHP |
| 460 | } |
| 461 | |
| 462 | // PostImportDBAction calls each apptype's detector until it finds a match, |
| 463 | // or returns 'php' as a last resort. |
no outgoing calls