Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/publisher/DivinerLivePublisher.php
Show All 20 Lines | if (!$this->book) { | ||||
$book->setConfigurationData($this->getConfigurationData())->save(); | $book->setConfigurationData($this->getConfigurationData())->save(); | ||||
$this->book = $book; | $this->book = $book; | ||||
} | } | ||||
return $this->book; | return $this->book; | ||||
} | } | ||||
private function loadSymbolForAtom(DivinerAtom $atom) { | private function loadSymbolForAtom(DivinerAtom $atom) { | ||||
$ref = $atom->getRef(); | |||||
$symbol = id(new DivinerAtomQuery()) | $symbol = id(new DivinerAtomQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
->withBookPHIDs(array($this->loadBook()->getPHID())) | ->withBookPHIDs(array($this->loadBook()->getPHID())) | ||||
->withTypes(array($atom->getType())) | ->withTypes(array($atom->getType())) | ||||
->withNames(array($atom->getName())) | ->withNames(array($ref->getName())) | ||||
->withContexts(array($atom->getContext())) | ->withContexts(array($ref->getContext())) | ||||
->withIndexes(array($this->getAtomSimilarIndex($atom))) | ->withIndexes(array($this->getAtomSimilarIndex($atom))) | ||||
->withIncludeUndocumentable(true) | ->withIncludeUndocumentable(true) | ||||
->withIncludeGhosts(true) | ->withIncludeGhosts(true) | ||||
->executeOne(); | ->executeOne(); | ||||
if ($symbol) { | if ($symbol) { | ||||
return $symbol; | return $symbol; | ||||
} | } | ||||
return id(new DivinerLiveSymbol()) | return id(new DivinerLiveSymbol()) | ||||
->setBookPHID($this->loadBook()->getPHID()) | ->setBookPHID($this->loadBook()->getPHID()) | ||||
->setType($atom->getType()) | ->setType($atom->getType()) | ||||
->setName($atom->getName()) | ->setName($ref->getName()) | ||||
->setContext($atom->getContext()) | ->setContext($ref->getContext()) | ||||
->setAtomIndex($this->getAtomSimilarIndex($atom)); | ->setAtomIndex($this->getAtomSimilarIndex($atom)); | ||||
} | } | ||||
private function loadAtomStorageForSymbol(DivinerLiveSymbol $symbol) { | private function loadAtomStorageForSymbol(DivinerLiveSymbol $symbol) { | ||||
$storage = id(new DivinerLiveAtom())->loadOneWhere( | $storage = id(new DivinerLiveAtom())->loadOneWhere( | ||||
'symbolPHID = %s', | 'symbolPHID = %s', | ||||
$symbol->getPHID()); | $symbol->getPHID()); | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | foreach ($hashes as $hash) { | ||||
$atom = $this->getAtomFromGraphHash($hash); | $atom = $this->getAtomFromGraphHash($hash); | ||||
$ref = $atom->getRef(); | $ref = $atom->getRef(); | ||||
$symbol = $this->loadSymbolForAtom($atom); | $symbol = $this->loadSymbolForAtom($atom); | ||||
$is_documentable = $this->shouldGenerateDocumentForAtom($atom); | $is_documentable = $this->shouldGenerateDocumentForAtom($atom); | ||||
$symbol | $symbol | ||||
->setDisplayName($ref->getDisplayName()) | |||||
->setDisplayContext($ref->getDisplayContext()) | |||||
->setLanguage($atom->getLanguage()) | |||||
->setGraphHash($hash) | ->setGraphHash($hash) | ||||
->setIsDocumentable((int)$is_documentable) | ->setIsDocumentable((int)$is_documentable) | ||||
->setTitle($ref->getTitle()) | |||||
->setGroupName($ref->getGroup()) | ->setGroupName($ref->getGroup()) | ||||
->setNodeHash($atom->getHash()); | ->setNodeHash($atom->getHash()); | ||||
if ($atom->getType() !== DivinerAtom::TYPE_FILE) { | if ($atom->getType() !== DivinerAtom::TYPE_FILE) { | ||||
$renderer = $this->getRenderer(); | $renderer = $this->getRenderer(); | ||||
$summary = $renderer->getAtomSummary($atom); | $summary = $renderer->getAtomSummary($atom); | ||||
$symbol->setSummary($summary); | $symbol->setSummary($summary); | ||||
} else { | } else { | ||||
Show All 32 Lines |