some bugfixes: unlink was not working on tempr. links (no id yet) hold in an array

This commit is contained in:
Ralf Becker 2006-01-11 05:18:48 +00:00
parent 15201df1b5
commit 7dd8eda157

View File

@ -149,7 +149,8 @@
{
$id1 = array( );
}
$link_id = $app2 != $this->vfs_appname ? "$app2:$id2" : "$app2:$id2[name]";
$link_id = $this->temp_link_id($app2,$id2);
$id1[$link_id] = array(
'app' => $app2,
'id' => $id2,
@ -207,6 +208,18 @@
return $link_id;
}
/**
* generate temporary link_id used as array-key
*
* @param string $app app-name
* @param mixed $id
* @return string
*/
function temp_link_id($app,$id)
{
return $app.':'.($app != $this->vfs_appname ? $id : $id['name']);
}
/**
* returns array of links to $app,$id (reimplemented to deal with not yet created items)
*
@ -273,6 +286,8 @@
{
if (is_array($id))
{
if (!strstr($app_link_id,':')) $app_link_id = $this->temp_link_id($app2,$id2); // create link_id of temporary link, if not given
if (isset($id[$app_link_id]) && is_array($id[$app_link_id])) // check for unlinked-marker
{
return $id[$app_link_id];
@ -353,10 +368,16 @@
return count($deleted);
}
if (!$link_id) $link_id = $this->temp_link_id($app2,$id2); // create link_id of temporary link, if not given
if (isset($id[$link_id]))
{
$id[$link_id] = False; // set the unlink marker
if ($this->debug)
{
_debug_array($id);
}
return True;
}
return False;