system_update: Perform provisioning in parallel
This commit is contained in:
parent
c091761762
commit
72d95f58ea
15 changed files with 182 additions and 27 deletions
29
internal/component/instances/php/settings.php
Normal file
29
internal/component/instances/php/settings.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
/** gets a setting from 'settings.php' */
|
||||
function get_setting($name) {
|
||||
use \Drupal\Core\Site\Settings;
|
||||
return Settings::get($name);
|
||||
}
|
||||
|
||||
/** sets a setting in 'settings.php' */
|
||||
function set_setting($name, $value) {
|
||||
// load install.inc
|
||||
if(is_file(DRUPAL_ROOT . "/internal/")) {
|
||||
include_once DRUPAL_ROOT . "/internal/core/includes/install.inc";
|
||||
} else {
|
||||
include_once DRUPAL_ROOT . "/core/includes/install.inc";
|
||||
}
|
||||
|
||||
// update the provided setting
|
||||
$settings["settings"][$name] = (object)[
|
||||
"value" => $value,
|
||||
"required" => TRUE,
|
||||
];
|
||||
|
||||
// find the filename
|
||||
$filename = DRUPAL_ROOT . "/" . \Drupal::service("site.path") . "/settings.php";
|
||||
drupal_rewrite_settings($settings, $filename);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ var exportPathbuilderPHP string
|
|||
|
||||
// Pathbuilders returns the ids of all pathbuilders in consistent order.
|
||||
func (wisski *WissKI) Pathbuilders() (ids []string, err error) {
|
||||
err = wisski.ExecPHPScript(stream.FromNil(), &ids, exportPathbuilderPHP, "all_list")
|
||||
err = wisski.ExecPHPScript(stream.FromDebug(), &ids, exportPathbuilderPHP, "all_list")
|
||||
slices.Sort(ids)
|
||||
return
|
||||
}
|
||||
|
|
@ -25,13 +25,13 @@ func (wisski *WissKI) Pathbuilders() (ids []string, err error) {
|
|||
// Pathbuilder returns a single pathbuilder as xml.
|
||||
// If it does not exist, it returns the empty string and nil error.
|
||||
func (wisski *WissKI) Pathbuilder(id string) (xml string, err error) {
|
||||
err = wisski.ExecPHPScript(stream.FromNil(), &xml, exportPathbuilderPHP, "one_xml", id)
|
||||
err = wisski.ExecPHPScript(stream.FromDebug(), &xml, exportPathbuilderPHP, "one_xml", id)
|
||||
return
|
||||
}
|
||||
|
||||
// AllPathbuilders returns all pathbuilders serialized as xml
|
||||
func (wisski *WissKI) AllPathbuilders() (pathbuilders map[string]string, err error) {
|
||||
err = wisski.ExecPHPScript(stream.FromNil(), &pathbuilders, exportPathbuilderPHP, "all_xml")
|
||||
err = wisski.ExecPHPScript(stream.FromDebug(), &pathbuilders, exportPathbuilderPHP, "all_xml")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/tkw1536/goprogram/stream"
|
||||
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
var ErrExecInvalidCode = errors.New("invalid code to execute")
|
||||
|
|
@ -123,3 +125,17 @@ func marshalPHP(data any) (string, error) {
|
|||
result := "call_user_func(function(){$x=<<<'" + delim + "'\n" + jstring + "\n" + delim + ";return json_decode(trim($x));})" // press to doubt
|
||||
return result, nil
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//go:embed php/settings.php
|
||||
var settingsPHP string
|
||||
|
||||
func (wisski *WissKI) GetSettingsPHP(key string) (value any, err error) {
|
||||
err = wisski.ExecPHPScript(stream.FromDebug(), &value, settingsPHP, "get_setting", key)
|
||||
return
|
||||
}
|
||||
|
||||
func (wisski *WissKI) SetSettingsPHP(key string, value any) error {
|
||||
return wisski.ExecPHPScript(stream.FromDebug(), nil, settingsPHP, "set_setting", key, value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ var listURIPrefixesPHP string
|
|||
// Prefixes returns the prefixes
|
||||
func (wisski *WissKI) Prefixes() (prefixes []string, err error) {
|
||||
// get all the ugly prefixes
|
||||
err = wisski.ExecPHPScript(stream.FromNil(), &prefixes, listURIPrefixesPHP, "list_prefixes")
|
||||
err = wisski.ExecPHPScript(stream.FromDebug(), &prefixes, listURIPrefixesPHP, "list_prefixes")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue