mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
call notification hook for unlink/rmdir only after successful removal, but with (not longer existing) stat data
This commit is contained in:
parent
c3c785de0b
commit
1e4c845aab
@ -450,17 +450,22 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// call "vfs_unlink" hook, before unlink
|
$stat = self::url_stat($path, STREAM_URL_STAT_LINK);
|
||||||
if (isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
|
||||||
|
self::symlinkCache_remove($path);
|
||||||
|
$ok = unlink($url);
|
||||||
|
|
||||||
|
// call "vfs_unlink" hook only after successful unlink, with data from (not longer possible) stat call
|
||||||
|
if ($ok && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->hooks->process(array(
|
$GLOBALS['egw']->hooks->process(array(
|
||||||
'location' => 'vfs_unlink',
|
'location' => 'vfs_unlink',
|
||||||
'path' => $path[0] == '/' ? $path : parse_url($path, PHP_URL_PATH),
|
'path' => $path[0] == '/' ? $path : parse_url($path, PHP_URL_PATH),
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
|
'stat' => $stat,
|
||||||
),'',true);
|
),'',true);
|
||||||
}
|
}
|
||||||
self::symlinkCache_remove($path);
|
return $ok;
|
||||||
return unlink($url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -564,17 +569,22 @@ class vfs_stream_wrapper implements iface_stream_wrapper
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// call "vfs_rmdir" hook, before removing
|
$stat = self::url_stat($path, STREAM_URL_STAT_LINK);
|
||||||
if (isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
|
||||||
|
self::symlinkCache_remove($path);
|
||||||
|
$ok = rmdir($url);
|
||||||
|
|
||||||
|
// call "vfs_rmdir" hook, only after successful rmdir
|
||||||
|
if ($ok && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->hooks->process(array(
|
$GLOBALS['egw']->hooks->process(array(
|
||||||
'location' => 'vfs_rmdir',
|
'location' => 'vfs_rmdir',
|
||||||
'path' => $path[0] == '/' ? $path : parse_url($path, PHP_URL_PATH),
|
'path' => $path[0] == '/' ? $path : parse_url($path, PHP_URL_PATH),
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
|
'stat' => $stat,
|
||||||
),'',true);
|
),'',true);
|
||||||
}
|
}
|
||||||
self::symlinkCache_remove($path);
|
return $ok;
|
||||||
return rmdir($url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user