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

Commit

Permalink
Handle repository with deleted parent. Should fix #1025
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Dec 22, 2015
1 parent dfd82d5 commit 6c74365
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -1118,10 +1118,18 @@ 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();
Expand Down
Expand Up @@ -670,8 +670,14 @@ public function switchAction($action, $httpVars, $fileVars)
continue;
}
$meta = array();
if($repositoryObject->getOption("META_SOURCES") != null){
$meta = array_keys($repositoryObject->getOption("META_SOURCES"));
try{
if($repositoryObject->getOption("META_SOURCES") != null){
$meta = array_keys($repositoryObject->getOption("META_SOURCES"));
}
}catch(Exception $e){
if(isSet($sharedRepos[$repositoryId])) unset($sharedRepos[$repositoryId]);
$this->logError("Invalid Share", "Repository $repositoryId has no more parent. Should be deleted.");
continue;
}
$repoDetailed[$repositoryId] = array(
"label" => SystemTextEncoding::toUTF8($repositoryObject->getDisplay()),
Expand Down

0 comments on commit 6c74365

Please sign in to comment.