Implement basic flavor support

This commit is contained in:
Tom Wiesing 2023-11-02 20:06:09 +01:00
parent 9a3e508ce8
commit d6c0c465e4
No known key found for this signature in database
24 changed files with 246 additions and 82 deletions

View file

@ -10,7 +10,7 @@ function get_setting($name) {
/** sets a setting in 'settings.php' */
function set_setting(string $name, mixed $value): bool {
// find settings.php
$filename = DRUPAL_ROOT . "/" . \Drupal::service("site.path") . "/settings.php";
$filename = DRUPAL_ROOT . "/" . \Drupal::getContainer()->getParameter("site.path") . "/settings.php";
// setup user write permissions for the file
$old = fileperms($filename);

View file

@ -0,0 +1,37 @@
package extras
import (
"context"
"github.com/FAU-CDI/wisski-distillery/internal/phpx"
"github.com/FAU-CDI/wisski-distillery/internal/status"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/php"
_ "embed"
)
// Version implements reading the current drupal version
type Version struct {
ingredient.Base
dependencies struct {
PHP *php.PHP
}
}
// Get returns the currently active theme
func (v *Version) Get(ctx context.Context, server *phpx.Server) (version string, err error) {
err = v.dependencies.PHP.EvalCode(
ctx, server, &version, "return Drupal::VERSION; ",
)
return
}
func (v *Version) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
if flags.Quick {
return
}
info.DrupalVersion, _ = v.Get(flags.Context, flags.Server)
return
}