mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Break out merge share creation so it can be overridden
This commit is contained in:
parent
2d644d930e
commit
66d6a6c883
@ -485,26 +485,7 @@ abstract class Merge
|
||||
}
|
||||
|
||||
// Get or create the share
|
||||
// Check if some other process created the share (with custom options)
|
||||
// and put it in the session cache for us
|
||||
$path = "$app::$id";
|
||||
$session = \EGroupware\Api\Cache::getSession(Api\Sharing::class, $path);
|
||||
if($session && $session['share_path'] == $path)
|
||||
{
|
||||
$share = $session;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Need to create the share here.
|
||||
// No way to know here if it should be writable, or who it's going to
|
||||
$mode = /* ? ? Sharing::WRITABLE :*/ Api\Sharing::READONLY;
|
||||
$recipients = array();
|
||||
$extra = array();
|
||||
|
||||
//$extra['share_writable'] |= ($mode == Sharing::WRITABLE ? 1 : 0);
|
||||
|
||||
$share = \EGroupware\Stylite\Link\Sharing::create($path, $mode, NULL, $recipients, $extra);
|
||||
}
|
||||
$share = $this->create_share($app, $id, $content);
|
||||
|
||||
if($share)
|
||||
{
|
||||
@ -514,6 +495,37 @@ abstract class Merge
|
||||
return $replacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a share for an entry
|
||||
*
|
||||
* @param string $app
|
||||
* @param string $id
|
||||
* @param string $path
|
||||
* @param type $content
|
||||
* @return type
|
||||
*/
|
||||
protected function create_share($app, $id, &$content)
|
||||
{
|
||||
// Check if some other process created the share (with custom options)
|
||||
// and put it in the session cache for us
|
||||
$path = "$app::$id";
|
||||
$session = \EGroupware\Api\Cache::getSession(Api\Sharing::class, $path);
|
||||
if($session && $session['share_path'] == $path)
|
||||
{
|
||||
return $session;
|
||||
}
|
||||
|
||||
// Need to create the share here.
|
||||
// No way to know here if it should be writable, or who it's going to
|
||||
$mode = /* ? ? Sharing::WRITABLE :*/ Api\Sharing::READONLY;
|
||||
$recipients = array();
|
||||
$extra = array();
|
||||
|
||||
//$extra['share_writable'] |= ($mode == Sharing::WRITABLE ? 1 : 0);
|
||||
|
||||
return \EGroupware\Stylite\Link\Sharing::create($path, $mode, NULL, $recipients, $extra);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a datetime
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user