From ae373c7d962b5e32f1dd9080e40815951c21c015 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 22 Jul 2020 09:40:21 +0000 Subject: [PATCH] [DEFAULTS][FIX] Fix logic error that kept reloading the table when the file wasn't modified --- src/Core/DB/DefaultSettings.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Core/DB/DefaultSettings.php b/src/Core/DB/DefaultSettings.php index 1291b469da..7b38264a32 100644 --- a/src/Core/DB/DefaultSettings.php +++ b/src/Core/DB/DefaultSettings.php @@ -41,12 +41,6 @@ abstract class DefaultSettings public static array $defaults; public static function setDefaults() { - $conf = DB::find('config', ['section' => 'site', 'setting' => 'defaults_modified']); - if ($conf != null && filemtime(__FILE__) < $conf->getValue()) { - // Don't bother modifying the table if this file is older - return; - } - self::$defaults = [ 'site' => [ 'name' => $_ENV['SOCIAL_SITENAME'] ?? 'Another social instance', @@ -250,6 +244,12 @@ abstract class DefaultSettings 'discovery' => ['CORS' => false], // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) ]; + $modified = Common::config('site', 'defaults_modified'); + if ($modified > filemtime(__FILE__)) { + // Don't bother modifying the table if this file is older + return; + } + self::loadDefaults($_ENV['APP_ENV'] == 'prod'); }