mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 18:41:08 +00:00
Fix recursive.
This commit is contained in:
@@ -15,6 +15,7 @@ use Auth;
|
|||||||
use Cache;
|
use Cache;
|
||||||
use FireflyIII\Models\Configuration;
|
use FireflyIII\Models\Configuration;
|
||||||
use FireflyIII\Models\Preference;
|
use FireflyIII\Models\Preference;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class FireflyConfig
|
* Class FireflyConfig
|
||||||
@@ -48,8 +49,11 @@ class FireflyConfig
|
|||||||
*/
|
*/
|
||||||
public function get($name, $default = null)
|
public function get($name, $default = null)
|
||||||
{
|
{
|
||||||
|
Log::debug('Now in FFConfig::get()', ['name' => $name]);
|
||||||
$fullName = 'ff-config-' . $name;
|
$fullName = 'ff-config-' . $name;
|
||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
|
Log::debug('Return cache.');
|
||||||
|
|
||||||
return Cache::get($fullName);
|
return Cache::get($fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,15 +61,20 @@ class FireflyConfig
|
|||||||
|
|
||||||
if ($config) {
|
if ($config) {
|
||||||
Cache::forever($fullName, $config);
|
Cache::forever($fullName, $config);
|
||||||
|
Log::debug('Return found one.');
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
// no preference found and default is null:
|
// no preference found and default is null:
|
||||||
if (is_null($default)) {
|
if (is_null($default)) {
|
||||||
// return NULL
|
// return NULL
|
||||||
|
Log::debug('Return null.');
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log::debug('Return this->set().');
|
||||||
|
|
||||||
return $this->set($name, $default);
|
return $this->set($name, $default);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -78,7 +87,10 @@ class FireflyConfig
|
|||||||
*/
|
*/
|
||||||
public function set($name, $value): Configuration
|
public function set($name, $value): Configuration
|
||||||
{
|
{
|
||||||
$item = $this->get($name, $value);
|
//
|
||||||
|
|
||||||
|
$item = new Configuration;
|
||||||
|
$item->name = $name;
|
||||||
$item->data = $value;
|
$item->data = $value;
|
||||||
$item->save();
|
$item->save();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user