[DEFAULTS][FIX] Fix logic error that kept reloading the table when the file wasn't modified

This commit is contained in:
Hugo Sales 2020-07-22 09:40:21 +00:00 committed by Hugo Sales
parent 3313897671
commit ae373c7d96
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -41,12 +41,6 @@ abstract class DefaultSettings
public static array $defaults; public static array $defaults;
public static function setDefaults() 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 = [ self::$defaults = [
'site' => [ 'site' => [
'name' => $_ENV['SOCIAL_SITENAME'] ?? 'Another social instance', '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.) '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'); self::loadDefaults($_ENV['APP_ENV'] == 'prod');
} }