Move wisski instance code to separate package

This commit is contained in:
Tom Wiesing 2022-10-17 14:20:15 +02:00
parent 7c3c84e116
commit 063f3f9b7d
No known key found for this signature in database
67 changed files with 533 additions and 409 deletions

View 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;
}