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

Commit

Permalink
Fix to inbox and CacheService
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecquet committed Mar 9, 2016
1 parent 7097ff8 commit d5a88dc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
31 changes: 18 additions & 13 deletions core/src/core/classes/class.AJXP_MetaStreamWrapper.php
Expand Up @@ -111,18 +111,25 @@ protected static function translateScheme($url, $crtInstance = null){
$newScheme = self::getNextScheme($url, $context);
$repository = ConfService::getRepositoryById(parse_url($url, PHP_URL_HOST));
if($currentScheme == "pydio" && $repository->hasContentFilter()){
$baseDir = $repository->getContentFilter()->getBaseDir();
if($crtInstance != null){
$crtInstance->currentUniquePath = $repository->getContentFilter()->getUniquePath();
}
if(!empty($baseDir) || $baseDir != "/"){
$crtPath = parse_url($url, PHP_URL_PATH);
$crtBase = basename($crtPath);
if(!empty($crtPath) && $crtPath != "/" && $crtBase != $repository->getContentFilter()->getUniquePath() && $crtBase != ".ajxp_meta"){
throw new Exception("Cannot find file ".$crtBase);

$contentFilter = $repository->getContentFilter();

if ($contentFilter instanceof ContentFilter) {
$baseDir = $contentFilter->getBaseDir();

if ($crtInstance != null) {
$crtInstance->currentUniquePath = $contentFilter->getUniquePath();
}

if (!empty($baseDir) || $baseDir != "/") {
$crtPath = parse_url($url, PHP_URL_PATH);
$crtBase = basename($crtPath);
if (!empty($crtPath) && $crtPath != "/" && $crtBase != $contentFilter->getUniquePath() && $crtBase != ".ajxp_meta") {
throw new Exception("Cannot find file " . $crtBase);
}
// Prepend baseDir in path
$url = str_replace($currentScheme . "://" . $repository->getId() . $crtPath, $currentScheme . "://" . $repository->getId() . rtrim($baseDir . $crtPath, "/"), $url);
}
// Prepend baseDir in path
$url = str_replace($currentScheme."://".$repository->getId().$crtPath, $currentScheme."://".$repository->getId().rtrim($baseDir.$crtPath, "/"), $url);
}
}

Expand All @@ -133,7 +140,6 @@ protected static function translateScheme($url, $crtInstance = null){
return $newUrl;
}

// TODO - problem here
protected static function findWrapperClassName($scheme, $context = "core"){

$metaWrappers = self::getMetaWrappers($context);
Expand Down Expand Up @@ -173,7 +179,6 @@ protected static function actualRepositoryWrapperData($repositoryId){
}
}


/**
* Return the final ajxp.XX wrapper class name.
* @param $repositoryId
Expand Down
29 changes: 23 additions & 6 deletions core/src/core/classes/class.CacheService.php
Expand Up @@ -27,9 +27,11 @@
*/
class CacheService
{

/**
* @param $id
* @return bool
*/
public static function contains($id) {
//var_dump('Cotnains' . $id);
$cacheDriver = ConfService::getCacheDriverImpl();

if ($cacheDriver) {
Expand All @@ -39,16 +41,26 @@ public static function contains($id) {
return false;
}

/**
* @param $id
* @param $object
* @param int $timelimit
* @return bool
*/
public static function save($id, $object, $timelimit = 0 ) {
$cacheDriver = ConfService::getCacheDriverImpl();

if ($cacheDriver) {
return $cacheDriver->save($id, $object, $timelimit = 0);
return $cacheDriver->save($id, $object, $timelimit);
}

return false;
}

/**
* @param $id
* @return bool|mixed
*/
public static function fetch($id) {
$cacheDriver = ConfService::getCacheDriverImpl();

Expand All @@ -60,8 +72,11 @@ public static function fetch($id) {
return false;
}

/**
* @param $id
* @return bool
*/
public static function delete($id) {
//var_dump('Delete' . $id);
$cacheDriver = ConfService::getCacheDriverImpl();

if ($cacheDriver) {
Expand All @@ -71,8 +86,10 @@ public static function delete($id) {
return false;
}

/**
* @return bool
*/
public static function deleteAll() {
//var_dump('Delete ALL' . $id);
$cacheDriver = ConfService::getCacheDriverImpl();

if ($cacheDriver) {
Expand All @@ -81,4 +98,4 @@ public static function deleteAll() {

return false;
}
}
}

0 comments on commit d5a88dc

Please sign in to comment.