1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-11 17:32:41 +01:00
phorge-phorge/src/applications/search/storage/PhabricatorSavedQuery.php
Joshua Spence 8756d82cf6 Remove @group annotations
Summary: I'm pretty sure that `@group` annotations are useless now... see D9855. Also fixed various other minor issues.

Test Plan: Eye-ball it.

Reviewers: #blessed_reviewers, epriestley, chad

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Differential Revision: https://secure.phabricator.com/D9859
2014-07-10 08:12:48 +10:00

67 lines
1.5 KiB
PHP

<?php
final class PhabricatorSavedQuery extends PhabricatorSearchDAO
implements PhabricatorPolicyInterface {
protected $parameters = array();
protected $queryKey;
protected $engineClassName;
public function getConfiguration() {
return array(
self::CONFIG_SERIALIZATION => array(
'parameters' => self::SERIALIZATION_JSON,
),
) + parent::getConfiguration();
}
public function setParameter($key, $value) {
$this->parameters[$key] = $value;
return $this;
}
public function getParameter($key, $default = null) {
return idx($this->parameters, $key, $default);
}
public function save() {
if ($this->getEngineClassName() === null) {
throw new Exception(pht('Engine class is null.'));
}
// Instantiate the engine to make sure it's valid.
$this->newEngine();
$serial = $this->getEngineClassName().serialize($this->parameters);
$this->queryKey = PhabricatorHash::digestForIndex($serial);
return parent::save();
}
public function newEngine() {
return newv($this->getEngineClassName(), array());
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
);
}
public function getPolicy($capability) {
return PhabricatorPolicies::POLICY_PUBLIC;
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return false;
}
public function describeAutomaticCapability($capability) {
return null;
}
}