Differential D14691 Diff 35538 src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/query/PhabricatorEditEngineConfigurationQuery.php
<?php | <?php | ||||
final class PhabricatorEditEngineConfigurationQuery | final class PhabricatorEditEngineConfigurationQuery | ||||
extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $engineKeys; | private $engineKeys; | ||||
private $builtinKeys; | private $builtinKeys; | ||||
private $identifiers; | private $identifiers; | ||||
private $default; | private $default; | ||||
private $disabled; | private $disabled; | ||||
private $ignoreDatabaseConfigurations; | |||||
public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
$this->ids = $ids; | $this->ids = $ids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withPHIDs(array $phids) { | public function withPHIDs(array $phids) { | ||||
$this->phids = $phids; | $this->phids = $phids; | ||||
Show All 20 Lines | public function withIsDefault($default) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withIsDisabled($disabled) { | public function withIsDisabled($disabled) { | ||||
$this->disabled = $disabled; | $this->disabled = $disabled; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withIgnoreDatabaseConfigurations($ignore) { | |||||
$this->ignoreDatabaseConfigurations = $ignore; | |||||
return $this; | |||||
} | |||||
public function newResultObject() { | public function newResultObject() { | ||||
return new PhabricatorEditEngineConfiguration(); | return new PhabricatorEditEngineConfiguration(); | ||||
} | } | ||||
protected function loadPage() { | protected function loadPage() { | ||||
// TODO: The logic here is a little flimsy and won't survive pagination. | // TODO: The logic here is a little flimsy and won't survive pagination. | ||||
// For now, I'm just not bothering with pagination since I believe it will | // For now, I'm just not bothering with pagination since I believe it will | ||||
// take some time before any install manages to produce a large enough | // take some time before any install manages to produce a large enough | ||||
// number of edit forms for any particular engine for the lack of UI | // number of edit forms for any particular engine for the lack of UI | ||||
// pagination to become a problem. | // pagination to become a problem. | ||||
if ($this->ignoreDatabaseConfigurations) { | |||||
$page = array(); | |||||
} else { | |||||
$page = $this->loadStandardPage($this->newResultObject()); | $page = $this->loadStandardPage($this->newResultObject()); | ||||
} | |||||
// Now that we've loaded the real results from the database, we're going | // Now that we've loaded the real results from the database, we're going | ||||
// to load builtins from the edit engines and add them to the list. | // to load builtins from the edit engines and add them to the list. | ||||
$engines = PhabricatorEditEngine::getAllEditEngines(); | $engines = PhabricatorEditEngine::getAllEditEngines(); | ||||
if ($this->engineKeys) { | if ($this->engineKeys) { | ||||
$engines = array_select_keys($engines, $this->engineKeys); | $engines = array_select_keys($engines, $this->engineKeys); | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |