protected function _getFolderUidForBackendId($id, $type = null, $old_id = null)
{
// Always use 'RI' for Recipient cache.
if ($id == 'RI') {
return 'RI';
}
$map = $this->_state->getFolderUidToBackendIdMap();
// Rename?
if (!empty($old_id) && !empty($map[$old_id])) {
$this->_tempMap[$id] = $map[$old_id];
}
if (!empty($map[$id])) {
return $map[$id];
} elseif (!empty($this->_tempMap[$id])) {
return $this->_tempMap[$id];
}
// Convert TYPE to CLASS
$type = $this->_getClassFromType($type);
$rMap = array_flip($this->_typeMap);
$prefix = $rMap[$type];
// None found, generate a new UID.
$this->_tempMap[$id] = sprintf('%s%04x%04x', $prefix, mt_rand(0, 0xffff), mt_rand(0, 0xffff));
$this->_logger->info(sprintf('[%s] Creating new folder uuid for %s: %s', getmypid(), $id, $this->_tempMap[$id]));
return $this->_tempMap[$id];
}