@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow `DivinerPublisher` to be specified as a flag

Summary: Allow the `DivinerPublisher` subclass to be specified via `./bin/divner generate --publisher ...`. In particular, this allows use of the (mostly broken) `DivinerStaticPublisher`.

Test Plan: Ran `./bin/diviner generate --publisher DivinerStaticPublisher`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11588

+30 -8
+1
src/applications/diviner/publisher/DivinerPublisher.php
··· 42 42 $this->atomCache = $cache; 43 43 $graph_map = $this->atomCache->getGraphMap(); 44 44 $this->atomGraphHashToNodeHashMap = array_flip($graph_map); 45 + return $this; 45 46 } 46 47 47 48 protected function getAtomFromGraphHash($graph_hash) {
+29 -8
src/applications/diviner/workflow/DivinerGenerateWorkflow.php
··· 19 19 'param' => 'path', 20 20 'help' => pht('Path to a Diviner book configuration.'), 21 21 ), 22 + array( 23 + 'name' => 'publisher', 24 + 'param' => 'class', 25 + 'help' => pht('Specify a subclass of %s.', 'DivinerPublisher'), 26 + 'default' => 'DivinerLivePublisher', 27 + ), 22 28 )); 23 29 } 24 30 ··· 164 170 $this->buildAtomCache(); 165 171 $this->buildGraphCache(); 166 172 167 - $this->publishDocumentation($args->getArg('clean')); 173 + $publisher_class = $args->getArg('publisher'); 174 + $symbols = id(new PhutilSymbolLoader()) 175 + ->setName($publisher_class) 176 + ->setConcreteOnly(true) 177 + ->setAncestorClass('DivinerPublisher') 178 + ->selectAndLoadSymbols(); 179 + if (!$symbols) { 180 + throw new Exception( 181 + pht( 182 + "Publisher class '%s' must be a concrete subclass of %s.", 183 + $publisher_class, 184 + 'DivinerPublisher')); 185 + } 186 + $publisher = newv($publisher_class, array()); 187 + 188 + $this->publishDocumentation($args->getArg('clean'), $publisher); 168 189 } 169 190 170 191 /* -( Atom Cache )--------------------------------------------------------- */ ··· 497 518 return md5(serialize($inputs)).'G'; 498 519 } 499 520 500 - private function publishDocumentation($clean) { 521 + private function publishDocumentation($clean, DivinerPublisher $publisher) { 501 522 $atom_cache = $this->getAtomCache(); 502 523 $graph_map = $atom_cache->getGraphMap(); 503 524 504 525 $this->log(pht('PUBLISHING DOCUMENTATION')); 505 526 506 - $publisher = new DivinerLivePublisher(); 507 - $publisher->setDropCaches($clean); 508 - $publisher->setConfig($this->getAllConfig()); 509 - $publisher->setAtomCache($atom_cache); 510 - $publisher->setRenderer(new DivinerDefaultRenderer()); 511 - $publisher->publishAtoms(array_values($graph_map)); 527 + $publisher 528 + ->setDropCaches($clean) 529 + ->setConfig($this->getAllConfig()) 530 + ->setAtomCache($atom_cache) 531 + ->setRenderer(new DivinerDefaultRenderer()) 532 + ->publishAtoms(array_values($graph_map)); 512 533 513 534 $this->log(pht('Done.')); 514 535 }