-
Notifications
You must be signed in to change notification settings - Fork 787
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mvc:JsonKeyValueStoreField - restore support for json input data with…
- Loading branch information
1 parent
b962ccd
commit 83be9bb
Showing
1 changed file
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,17 +123,18 @@ public function setConfigdPopulateTTL($value) | |
protected function actionPostLoadingEvent() | ||
{ | ||
$data = null; | ||
if ($this->internalSourceFile != null && $this->internalSourceField != null) { | ||
$sourcefile = sprintf($this->internalSourceFile, $this->internalSourceField); | ||
} else { | ||
$sourcefile = $this->internalSourceFile; | ||
} | ||
$cachename = $sourcefile != null ? $sourcefile : $this->internalConfigdPopulateAct; | ||
if (!empty($this->internalConfigdPopulateAct)) { | ||
if (isset(static::$internalStaticContent[$this->internalConfigdPopulateAct])) { | ||
if (isset(static::$internalStaticContent[$cachename])) { | ||
/* cached for the lifetime of this session */ | ||
$data = static::$internalStaticContent[$this->internalConfigdPopulateAct]; | ||
} elseif ($this->internalSourceFile != null) { | ||
$data = static::$internalStaticContent[$cachename]; | ||
} elseif ($sourcefile != null) { | ||
/* use a file cache for the configd call*/ | ||
if ($this->internalSourceField != null) { | ||
$sourcefile = sprintf($this->internalSourceFile, $this->internalSourceField); | ||
} else { | ||
$sourcefile = $this->internalSourceFile; | ||
} | ||
if (is_file($sourcefile)) { | ||
$sourcehandle = fopen($sourcefile, "r+"); | ||
} else { | ||
|
@@ -166,12 +167,18 @@ protected function actionPostLoadingEvent() | |
true | ||
); | ||
} | ||
if ($data != null) { | ||
static::$internalStaticContent[$this->internalConfigdPopulateAct] = $data; | ||
$this->internalOptionList = $data; | ||
if ($this->internalSelectAll && $this->internalValue == "") { | ||
$this->internalValue = implode(',', array_keys($this->internalOptionList)); | ||
} | ||
} elseif ($sourcefile != null && isfile($sourcefile)) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
AdSchellevis
Author
Member
|
||
if (isset(static::$internalStaticContent[$cachename])) { | ||
$data = static::$internalStaticContent[$cachename]; | ||
} else { | ||
$data = json_decode(file_get_contents($sourcefile), true) ?? []; | ||
} | ||
} | ||
if ($data != null) { | ||
static::$internalStaticContent[$cachename] = $data; | ||
$this->internalOptionList = $data; | ||
if ($this->internalSelectAll && $this->internalValue == "") { | ||
$this->internalValue = implode(',', array_keys($this->internalOptionList)); | ||
} | ||
} | ||
} | ||
|
@AdSchellevis
is_file()
?