Permalink
Browse files

Remove full tree cache from filehasher; now integrated directly into …

…cache server.
  • Loading branch information...
1 parent 7dafda9 commit 60bce30abc8068e148b09336becedb075512de39 @cdujeu cdujeu committed May 9, 2016
@@ -43,7 +43,7 @@ public function switchAction($action, $httpVars, $filesVars)
{
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(true)) {
- return false;
+ return;
}
if (!isSet($this->pluginConf)) {
$this->pluginConf = array("GENERATE_THUMBNAIL"=>false);
@@ -22,7 +22,6 @@
use Pydio\Access\Core\AJXP_MetaStreamWrapper;
use Pydio\Access\Core\AJXP_Node;
use Pydio\Access\Core\UserSelection;
-use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\LocalCache;
use Pydio\Core\Controller\Controller;
use Pydio\Core\Utils\Utils;
@@ -103,51 +102,11 @@ public function initMeta($accessDriver)
$this->metaStore->initMeta($accessDriver);
}
- private function getTreeName()
- {
- $repo = $this->accessDriver->repository;
- $base = AJXP_SHARED_CACHE_DIR."/trees/tree-".$repo->getId();
- $secuScope = $repo->securityScope();
- if ($secuScope == "USER") {
- $base .= "-".AuthService::getLoggedUser()->getId();
- } else if ($secuScope == "GROUP") {
- $base .= "-".str_replace("/", "_", AuthService::getLoggedUser()->getGroupPath());
- }
- return $base . "-full.xml";
- }
-
- public function checkFullTreeCache($actionName, &$httpVars, &$fileVars)
- {
- $cName = $this->getTreeName();
- if (is_file($cName)) {
- header('Content-Type: text/xml; charset=UTF-8');
- header('Cache-Control: no-cache');
- if ( strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') ) {
- header('Content-Encoding:deflate');
- readfile($cName.".gz");
- } else {
- readfile($cName);
- }
- exit();
- }
- }
-
- public function cacheFullTree($actionName, $httpVars, $postProcessData)
- {
- $cName = $this->getTreeName();
- if(!is_dir(dirname($cName))) mkdir(dirname($cName));
- $xmlString = $postProcessData["ob_output"];
- file_put_contents($cName, $xmlString);
- file_put_contents($cName.".gz", gzdeflate($xmlString, 9));
- print($xmlString);
- }
-
public function switchActions($actionName, $httpVars, $fileVars)
{
- //$urlBase = $this->accessDriver
$repository = $this->accessDriver->repository;
if (!$repository->detectStreamWrapper(true)) {
- return false;
+ return;
}
$selection = new UserSelection($repository, $httpVars);
switch ($actionName) {
@@ -317,9 +276,6 @@ public function invalidateHash($oldNode = null, $newNode = null, $copy = false)
if ($oldNode != null) {
$this->metaStore->removeMetadata($oldNode, FileHasher::METADATA_HASH_NAMESPACE, false, AJXP_METADATA_SCOPE_GLOBAL);
}
- if ($this->getFilteredOption("CACHE_XML_TREE") === true && is_file($this->getTreeName())) {
- @unlink($this->getTreeName());
- }
}
@@ -3,7 +3,6 @@
xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<class_definition filename="plugins/meta.filehasher/class.FileHasher.php" classname="FileHasher"/>
<server_settings>
- <param name="CACHE_XML_TREE" type="boolean" default="false" label="CONF_MESSAGE[Cache full tree]" description="CONF_MESSAGE[Cache XML tree and invalidate on node change]"/>
<global_param name="RSYNC_SUPPORTED" type="boolean" label="CONF_MESSAGE[Rsync Support]" description="CONF_MESSAGE[Dont edit, it will be detected by the server]" expose="true"/>
</server_settings>
<client_settings>
@@ -46,14 +45,6 @@
</serverCallback>
</processing>
</action>
- <action name="ls" dirDefault="true">
- <pre_processing>
- <serverCallback methodName="checkFullTreeCache" applyCondition="$apply=isSet($httpVars['recursive']);"/>
- </pre_processing>
- <post_processing>
- <serverCallback methodName="cacheFullTree" capture="true" applyCondition="$apply=isSet($httpVars['recursive']);"/>
- </post_processing>
- </action>
</actions>
<hooks>
<serverCallback hookName="node.info" methodName="getFileHash" applyCondition="$apply = isSet($_GET['recursive']);"/>

0 comments on commit 60bce30

Please sign in to comment.