Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Last update of Inbox driver
Browse files Browse the repository at this point in the history
Ping remote when receiving share.
  • Loading branch information
cdujeu committed Feb 25, 2016
1 parent 89efd06 commit e0c03ee
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions core/src/ocs.php
Expand Up @@ -31,6 +31,8 @@
$confStorageDriver = ConfService::getConfStorageImpl();
require_once($confStorageDriver->getUserClassFileName());

$pServ->initActivePlugins();

/**
* @var Pydio\OCS\OCSPlugin $coreLoader
*/
Expand Down
10 changes: 8 additions & 2 deletions core/src/plugins/access.inbox/class.inboxAccessDriver.php
Expand Up @@ -38,11 +38,17 @@ public function loadNodeInfo(&$ajxpNode, $parentNode = false, $details = false)
$targetUrl = inboxAccessWrapper::translateURL($ajxpNode->getUrl());
$repoId = parse_url($targetUrl, PHP_URL_HOST);
$r = ConfService::getRepositoryById($repoId);
$owner = $r->getOwner();
if(!is_null($r)){
$owner = $r->getOwner();
$creationTime = $r->getOption("CREATION_TIME");
}else{
$owner = "http://".parse_url($targetUrl, PHP_URL_HOST);
$creationTime = time();
}
$leaf = $ajxpNode->isLeaf();
$meta = array(
"shared_repository_id" => $repoId,
"ajxp_description" => ($leaf?"File":"Folder")." shared by ".$owner. " ". AJXP_Utils::relativeDate($r->getOption("CREATION_TIME"), $mess)
"ajxp_description" => ($leaf?"File":"Folder")." shared by ".$owner. " ". AJXP_Utils::relativeDate($creationTime, $mess)
);
if(!$leaf){
$meta["ajxp_mime"] = "shared_folder";
Expand Down
11 changes: 8 additions & 3 deletions core/src/plugins/access.inbox/class.inboxAccessWrapper.php
Expand Up @@ -45,7 +45,7 @@ protected static function getNodes(){
$repos = ConfService::getAccessibleRepositories();
self::$output = array();
foreach($repos as $repo){
if(!$repo->hasParent()){
if(!$repo->hasOwner()){
continue;
}
if($repo->hasContentFilter()){
Expand Down Expand Up @@ -94,7 +94,12 @@ public static function translateURL($path){
}
if($pydioScheme){
$node = new AJXP_Node($url);
ConfService::loadDriverForRepository($node->getRepository());
$node->getRepository()->driverInstance = null;
try{
ConfService::loadDriverForRepository($node->getRepository());
}catch (Exception $e){

}
$node->getRepository()->detectStreamWrapper(true);
}
return $url;
Expand Down Expand Up @@ -389,7 +394,7 @@ public function url_stat($path, $flags)
if(self::$linkNode !== null){
ConfService::loadDriverForRepository(self::$linkNode->getRepository());
}
$this->disableWriteInStat($stat);
//$this->disableWriteInStat($stat);
return $stat;
}

Expand Down
14 changes: 3 additions & 11 deletions core/src/plugins/core.ocs/src/server/Federated/Server.php
Expand Up @@ -72,12 +72,7 @@ protected function actionReceive($parameters){
throw new InvalidArgumentsException();
}

// TODO:
// -- Ping Remote to discover OcsServiceUrl & OcsDavURL
// -- Ping Dav endpoint to detect if password & if file or folder
// -- Can we not use the Virtual repo there ?? Better if access was done through access.webdav
$endpoints = OCSClient::findEndpointsForURL($remote);
//$parameters += OCSClient::pingDAVEndpoint();

$share = new RemoteShare();
$share->setUser($targetUser);
Expand All @@ -88,13 +83,10 @@ protected function actionReceive($parameters){
$share->setReceptionDate(time());
$share->setStatus(OCS_INVITATION_STATUS_PENDING);

$share->setOcsServiceUrl($endpoints['shares']);
$share->setOcsDavUrl($endpoints['dav']);
$share->setOcsServiceUrl(rtrim($remote, '/').$endpoints['share']);
$share->setOcsDavUrl(rtrim($remote, '/').$endpoints['webdav']);

// Populated from the DAV ping above
if(isset($parameters["isFile"]) && $parameters["isFile"] == "true"){
$share->setDocumentIsLeaf(true);
}
$share->pingRemoteDAVPoint();

$store = new SQLStore();
$newShare = $store->storeRemoteShare($share);
Expand Down

0 comments on commit e0c03ee

Please sign in to comment.