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

Commit

Permalink
Revert the $plugin instance cloning, broke the REST api. Instead, mak…
Browse files Browse the repository at this point in the history
…e sure to reload node driver on original node after applying forward event.
  • Loading branch information
cdujeu committed Mar 17, 2014
1 parent 8d35d17 commit cc791f5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
7 changes: 1 addition & 6 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -1195,12 +1195,7 @@ public function loadRepositoryDriverREST(&$repository)
}
$accessType = $repository->getAccessType();
$pServ = AJXP_PluginsService::getInstance();
$plugInstanceOrig = $pServ->getPluginByTypeName("access", $accessType);
if(!empty($plugInstanceOrig->repository) && $plugInstanceOrig->repository != $repository){
$plugInstance = clone $plugInstanceOrig;
}else{
return $plugInstanceOrig;
}
$plugInstance = $pServ->getPluginByTypeName("access", $accessType);

// TRIGGER BEFORE INIT META
$metaSources = $repository->getOption("META_SOURCES");
Expand Down
32 changes: 28 additions & 4 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -641,21 +641,45 @@ public function forwardEventToShares($fromNode=null, $toNode=null, $copy = false
}

$this->applyForwardEvent($fromMirrors, $toMirrors, $copy, $direction);

if(count($fromMirrors) || count($toMirrors)){
// Make sure to switch back to correct repository in memory
if($fromNode != null) {
$fromNode->getRepository()->driverInstance = null;
$fromNode->setDriver(null);
$fromNode->getDriver();
}else if($toNode != null){
$toNode->getRepository()->driverInstance = null;
$toNode->setDriver(null);
$toNode->getDriver();
}
}
}

public function forwardEventToSharesAction($actionName, $httpVars, $fileVars){

$fromMirrors = null;
$toMirrors = null;
if(!empty($httpVars["from"])){
$fromMirrors = $this->findMirrorNodesInShares(new AJXP_Node($httpVars["from"]), $httpVars["direction"]);
$fromNode = new AJXP_Node($httpVars["from"]);
$fromMirrors = $this->findMirrorNodesInShares($fromNode, $httpVars["direction"]);
}
if(!empty($httpVars["to"])){
$toMirrors = $this->findMirrorNodesInShares(new AJXP_Node($httpVars["to"]), $httpVars["direction"]);
$toNode = new AJXP_Node($httpVars["to"]);
$toMirrors = $this->findMirrorNodesInShares($toNode, $httpVars["direction"]);
}
$this->applyForwardEvent($fromMirrors, $toMirrors, ($httpVars["copy"] === "true"), $httpVars["direction"]);

if(count($fromMirrors) || count($toMirrors)){
// Make sure to switch back to correct repository in memory
if($fromNode != null) {
$fromNode->getRepository()->driverInstance = null;
$fromNode->setDriver(null);
$fromNode->getDriver();
}else if($toNode != null){
$toNode->getRepository()->driverInstance = null;
$toNode->setDriver(null);
$toNode->getDriver();
}
}
}


Expand Down

0 comments on commit cc791f5

Please sign in to comment.