tag add more customized options + NexusDB::rememter()

This commit is contained in:
xiaomlove
2022-03-28 15:58:12 +08:00
parent d15a837188
commit b613a46b8d
13 changed files with 164 additions and 33 deletions
+2 -1
View File
@@ -12,7 +12,6 @@ if (!file_exists($rootpath . '.env')) {
require $rootpath . 'nexus/Database/helpers.php';
require $rootpath . 'classes/class_cache_redis.php';
require $rootpath . 'include/eloquent.php';
require $rootpath . 'include/config.php';
ini_set('date.timezone', nexus_config('nexus.timezone'));
ini_set('error_reporting', E_ALL);
@@ -24,6 +23,8 @@ if (!in_array(nexus()->getScript(), ['announce', 'scrape'])) {
}
$Cache = new class_cache_redis(); //Load the caching class
$Cache->setLanguageFolderArray(get_langfolder_list());
require $rootpath . 'include/config.php';
define('TIMENOW', time());
$USERUPDATESET = array();
$query_name=array();
+15 -11
View File
@@ -282,19 +282,23 @@ function get_setting($name = null)
{
static $settings;
if (is_null($settings)) {
//get all settings from database
$sql = "select name, value from settings";
$result = sql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$value = $row['value'];
if (!is_null($value)) {
$arr = json_decode($value, true);
if (is_array($arr)) {
$value = $arr;
$settings = \Nexus\Database\NexusDB::remember("nexus_settings_in_nexus" . __METHOD__, 10, function () {
//get all settings from database
$sql = "select name, value from settings";
$result = sql_query($sql);
$final = [];
while ($row = mysql_fetch_assoc($result)) {
$value = $row['value'];
if (!is_null($value)) {
$arr = json_decode($value, true);
if (is_array($arr)) {
$value = $arr;
}
}
arr_set($final, $row['name'], $value);
}
arr_set($settings, $row['name'], $value);
}
return $final;
});
}
if (is_null($name)) {
return $settings;