Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/publisher/DivinerLivePublisher.php
| <?php | <?php | ||||
| final class DivinerLivePublisher extends DivinerPublisher { | final class DivinerLivePublisher extends DivinerPublisher { | ||||
| private $book; | private $book; | ||||
| private function loadBook() { | private function loadBook() { | ||||
| if (!$this->book) { | if (!$this->book) { | ||||
| $book_name = $this->getConfig('name'); | $book_name = $this->getConfig('name'); | ||||
| $book = id(new DivinerLiveBook())->loadOneWhere('name = %s', $book_name); | $book = id(new DivinerLiveBook())->loadOneWhere('name = %s', $book_name); | ||||
| if (!$book) { | if (!$book) { | ||||
| $book = id(new DivinerLiveBook()) | $book = id(new DivinerLiveBook()) | ||||
| ->setName($book_name) | ->setName($book_name) | ||||
| ->setViewPolicy(PhabricatorPolicies::POLICY_USER) | ->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy()) | ||||
| ->save(); | ->save(); | ||||
| } | } | ||||
| $book->setConfigurationData($this->getConfigurationData())->save(); | $book->setConfigurationData($this->getConfigurationData())->save(); | ||||
| $this->book = $book; | $this->book = $book; | ||||
| id(new PhabricatorSearchIndexer()) | id(new PhabricatorSearchIndexer()) | ||||
| ->queueDocumentForIndexing($book->getPHID()); | ->queueDocumentForIndexing($book->getPHID()); | ||||
| ▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines | |||||