2012-12-28 00:20:09 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO {
|
|
|
|
|
|
|
|
protected $id;
|
|
|
|
protected $phid;
|
|
|
|
protected $namespace;
|
|
|
|
protected $configKey;
|
|
|
|
protected $value;
|
2013-01-01 23:09:29 +01:00
|
|
|
protected $isDeleted;
|
2012-12-28 00:20:09 +01:00
|
|
|
|
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'value' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function generatePHID() {
|
|
|
|
return PhabricatorPHID::generateNewPHID(
|
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_CONF);
|
|
|
|
}
|
|
|
|
|
2013-03-06 23:14:09 +01:00
|
|
|
public static function loadConfigEntry($key) {
|
|
|
|
$config_entry = id(new PhabricatorConfigEntry())
|
|
|
|
->loadOneWhere(
|
|
|
|
'configKey = %s AND namespace = %s',
|
|
|
|
$key,
|
|
|
|
'default');
|
|
|
|
|
|
|
|
if (!$config_entry) {
|
|
|
|
$config_entry = id(new PhabricatorConfigEntry())
|
|
|
|
->setConfigKey($key)
|
|
|
|
->setNamespace('default');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $config_entry;
|
|
|
|
}
|
|
|
|
|
2012-12-28 00:20:09 +01:00
|
|
|
}
|