Commit 37251f16 authored by Manfred Kutas's avatar Manfred Kutas

ZP-1256 Rebuild backend2folderidCache of ASDevice if it's not available.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 603250a2
...@@ -673,13 +673,14 @@ class ASDevice extends StateObject { ...@@ -673,13 +673,14 @@ class ASDevice extends StateObject {
*/ */
public function GetFolderIdForBackendId($backendid, $generateNewIdIfNew, $folderOrigin, $folderName) { public function GetFolderIdForBackendId($backendid, $generateNewIdIfNew, $folderOrigin, $folderName) {
// build the backend-to-folderId backwards cache once // build the backend-to-folderId backwards cache once
if ($this->backend2folderidCache === false) { if ($this->backend2folderidCache === false || is_null($this->backend2folderidCache)) {
$this->backend2folderidCache = array(); $backend2folderidCache = array();
foreach ($this->contentData as $folderid => $data) { foreach ($this->contentData as $folderid => $data) {
if (isset($data[self::FOLDERBACKENDID])) { if (isset($data[self::FOLDERBACKENDID])) {
$this->backend2folderidCache[$data[self::FOLDERBACKENDID]] = $folderid; $backend2folderidCache[$data[self::FOLDERBACKENDID]] = $folderid;
} }
} }
$this->backend2folderidCache = $backend2folderidCache;
// if we couldn't find any backend-folderids but there is data in contentdata, then this is an old profile. // if we couldn't find any backend-folderids but there is data in contentdata, then this is an old profile.
// do not generate new folderids in this case // do not generate new folderids in this case
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment