GetDrupalVersion finds the drupal8+ version so it can be used for setting requirements. It can only work if there is configured Drupal8+ code
(app *DdevApp)
| 317 | // for setting requirements. |
| 318 | // It can only work if there is configured Drupal8+ code |
| 319 | func GetDrupalVersion(app *DdevApp) (string, error) { |
| 320 | // For drupal6/7 we use the apptype provided as version |
| 321 | switch app.Type { |
| 322 | case nodeps.AppTypeDrupal6: |
| 323 | return "6", nil |
| 324 | case nodeps.AppTypeDrupal7: |
| 325 | return "7", nil |
| 326 | } |
| 327 | // Otherwise figure out the version from existing code |
| 328 | f := filepath.Join(app.GetAbsDocroot(false), "core/lib/Drupal.php") |
| 329 | hasVersion, matches, err := fileutil.GrepStringInFile(f, `const VERSION = '([0-9]+)`) |
| 330 | v := "" |
| 331 | if hasVersion { |
| 332 | v = matches[1] |
| 333 | } |
| 334 | return v, err |
| 335 | } |
| 336 | |
| 337 | // isDrupal6App returns true if the app is of type Drupal6 |
| 338 | func isDrupal6App(app *DdevApp) bool { |
no test coverage detected