예제 #1
0
 /**
  * See static method
  * @param $repoId
  * @return int
  */
 public function deleteRepositoryInst($repoId)
 {
     AJXP_Controller::applyHook("workspace.before_delete", array($repoId));
     $confStorage = self::getConfStorageImpl();
     $shares = $confStorage->listRepositoriesWithCriteria(array("parent_uuid" => $repoId));
     $toDelete = array();
     foreach ($shares as $share) {
         $toDelete[] = $share->getId();
     }
     $res = $confStorage->deleteRepository($repoId);
     if ($res == -1) {
         return $res;
     }
     foreach ($toDelete as $deleteId) {
         $this->deleteRepositoryInst($deleteId);
     }
     AJXP_Controller::applyHook("workspace.after_delete", array($repoId));
     AJXP_Logger::info(__CLASS__, "Delete Repository", array("repo_id" => $repoId));
     $this->invalidateLoadedRepositories();
     CacheService::delete(AJXP_CACHE_SERVICE_NS_SHARED, "repository:" . $repoId);
     return 0;
 }
예제 #2
0
 /**
  * @param AJXP_Node $node
  */
 protected function clearCacheForNode($node)
 {
     if ($node->isLeaf()) {
         // Clear meta
         CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, $this->computeId($node, true));
         CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, $this->computeId($node, false));
         // Clear stat
         CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, AbstractCacheDriver::computeIdForNode($node, "stat"));
         // Clear parent listing
         if ($node->getParent() !== null) {
             CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, AbstractCacheDriver::computeIdForNode($node->getParent(), "list"));
         }
     } else {
         $cacheDriver = ConfService::getCacheDriverImpl();
         $cacheDriver->deleteKeyStartingWith(AJXP_CACHE_SERVICE_NS_NODES, $this->computeId($node, true));
         $cacheDriver->deleteKeyStartingWith(AJXP_CACHE_SERVICE_NS_NODES, $this->computeId($node, false));
         $cacheDriver->deleteKeyStartingWith(AJXP_CACHE_SERVICE_NS_NODES, AbstractCacheDriver::computeIdForNode($node, "stat"));
         if ($node->getParent() !== null) {
             $cacheDriver->deleteKeyStartingWith(AJXP_CACHE_SERVICE_NS_NODES, AbstractCacheDriver::computeIdForNode($node->getParent(), "list"));
         } else {
             $cacheDriver->deleteKeyStartingWith(AJXP_CACHE_SERVICE_NS_NODES, AbstractCacheDriver::computeIdForNode($node, "list"));
         }
     }
 }
예제 #3
0
 /**
  * Remove a cache key.
  *
  * @param string $key Key to remove.
  */
 public function remove($key)
 {
     \CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, $key);
 }
 public static function clearDirCache($path)
 {
     $scheme = parse_url($path, PHP_URL_SCHEME);
     CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, str_replace($scheme . "://", "list://", $path));
 }