mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-21 18:37:31 +08:00
tag add more customized options + NexusDB::rememter()
This commit is contained in:
+2
-1
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user