Page MenuHomePhabricator

D13157.diff
No OneTemporary

D13157.diff

diff --git a/src/applications/diviner/controller/DivinerAtomController.php b/src/applications/diviner/controller/DivinerAtomController.php
--- a/src/applications/diviner/controller/DivinerAtomController.php
+++ b/src/applications/diviner/controller/DivinerAtomController.php
@@ -47,6 +47,8 @@
->withNames(array($this->atomName))
->withContexts(array($this->atomContext))
->withIndexes(array($this->atomIndex))
+ ->withGhosts(false)
+ ->withIsDocumentable(true)
->needAtoms(true)
->needExtends(true)
->needChildren(true)
diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php
--- a/src/applications/diviner/controller/DivinerBookController.php
+++ b/src/applications/diviner/controller/DivinerBookController.php
@@ -46,6 +46,8 @@
$atoms = id(new DivinerAtomQuery())
->setViewer($viewer)
->withBookPHIDs(array($book->getPHID()))
+ ->withGhosts(false)
+ ->withIsDocumentable(true)
->execute();
$atoms = msort($atoms, 'getSortKey');
diff --git a/src/applications/diviner/controller/DivinerFindController.php b/src/applications/diviner/controller/DivinerFindController.php
--- a/src/applications/diviner/controller/DivinerFindController.php
+++ b/src/applications/diviner/controller/DivinerFindController.php
@@ -41,6 +41,9 @@
$query->withTypes(array($type));
}
+ $query->withGhosts(false);
+ $query->withIsDocumentable(true);
+
$name_query = clone $query;
$name_query->withNames(
diff --git a/src/applications/diviner/publisher/DivinerLivePublisher.php b/src/applications/diviner/publisher/DivinerLivePublisher.php
--- a/src/applications/diviner/publisher/DivinerLivePublisher.php
+++ b/src/applications/diviner/publisher/DivinerLivePublisher.php
@@ -64,7 +64,7 @@
$symbols = id(new DivinerAtomQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withBookPHIDs(array($this->loadBook()->getPHID()))
- ->withIncludeUndocumentable(true)
+ ->withGhosts(false)
->execute();
return mpull($symbols, 'getGraphHash');
diff --git a/src/applications/diviner/query/DivinerAtomQuery.php b/src/applications/diviner/query/DivinerAtomQuery.php
--- a/src/applications/diviner/query/DivinerAtomQuery.php
+++ b/src/applications/diviner/query/DivinerAtomQuery.php
@@ -9,8 +9,8 @@
private $types;
private $contexts;
private $indexes;
- private $includeUndocumentable;
- private $includeGhosts;
+ private $isDocumentable;
+ private $isGhost;
private $nodeHashes;
private $titles;
private $nameContains;
@@ -81,9 +81,9 @@
/**
- * Include "ghosts", which are symbols which used to exist but do not exist
- * currently (for example, a function which existed in an older version of
- * the codebase but was deleted).
+ * Include or exclude "ghosts", which are symbols which used to exist but do
+ * not exist currently (for example, a function which existed in an older
+ * version of the codebase but was deleted).
*
* These symbols had PHIDs assigned to them, and may have other sorts of
* metadata that we don't want to lose (like comments or flags), so we don't
@@ -92,14 +92,11 @@
* have been generated incorrectly by accident. In these cases, we can
* restore the original data.
*
- * However, most callers are not interested in these symbols, so they are
- * excluded by default. You can use this method to include them in results.
- *
- * @param bool True to include ghosts.
+ * @param bool
* @return this
*/
- public function withIncludeGhosts($include) {
- $this->includeGhosts = $include;
+ public function withGhosts($ghosts) {
+ $this->isGhost = $ghosts;
return $this;
}
@@ -108,8 +105,8 @@
return $this;
}
- public function withIncludeUndocumentable($include) {
- $this->includeUndocumentable = $include;
+ public function withIsDocumentable($documentable) {
+ $this->isDocumentable = $documentable;
return $this;
}
@@ -346,16 +343,19 @@
$this->indexes);
}
- if (!$this->includeUndocumentable) {
+ if ($this->isDocumentable !== null) {
$where[] = qsprintf(
$conn_r,
- 'isDocumentable = 1');
+ 'isDocumentable = %d',
+ (int)$this->isDocumentable);
}
- if (!$this->includeGhosts) {
- $where[] = qsprintf(
- $conn_r,
- 'graphHash IS NOT NULL');
+ if ($this->isGhost !== null) {
+ if ($this->isGhost) {
+ $where[] = qsprintf($conn_r, 'graphHash IS NULL');
+ } else {
+ $where[] = qsprintf($conn_r, 'graphHash IS NOT NULL');
+ }
}
if ($this->nodeHashes) {
diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php
--- a/src/applications/diviner/storage/DivinerLiveBook.php
+++ b/src/applications/diviner/storage/DivinerLiveBook.php
@@ -93,8 +93,6 @@
$atoms = id(new DivinerAtomQuery())
->setViewer($engine->getViewer())
->withBookPHIDs(array($this->getPHID()))
- ->withIncludeGhosts(true)
- ->withIncludeUndocumentable(true)
->execute();
foreach ($atoms as $atom) {

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 8:54 PM (6 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7326131
Default Alt Text
D13157.diff (5 KB)

Event Timeline