mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
943c62d1e9
Summary: Ref T1191. - Adds definitions for missing keys and keys with wrong uniqueness. Generally, I defined these before fixing the key query to actually pull all keys and support uniqueness. - Moves "key uniqueness" to note severity; this is fixable (probably?) and there are no remaining issues. - Moves "Missing Key" to note severity; missing keys are fixable and all remaining missing keys are really missing (either missing edge keys, or missing PHID keys): {F210089} - Moves "Surplus Key" to note seveirty; surplus keys are fixable all remaining surplus keys are really surplus (duplicate key in Harbormaster, key on unused column in Worker): {F210090} Test Plan: - Vetted missing/surplus/unique messages. - 146 issues remaining. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10590
80 lines
1.9 KiB
PHP
80 lines
1.9 KiB
PHP
<?php
|
|
|
|
final class LegalpadDocumentBody extends LegalpadDAO
|
|
implements
|
|
PhabricatorMarkupInterface {
|
|
|
|
const MARKUP_FIELD_TEXT = 'markup:text ';
|
|
|
|
protected $phid;
|
|
protected $creatorPHID;
|
|
protected $documentPHID;
|
|
protected $version;
|
|
protected $title;
|
|
protected $text;
|
|
|
|
public function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_AUX_PHID => true,
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
'version' => 'uint32',
|
|
'title' => 'text255',
|
|
'text' => 'text?',
|
|
),
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
'key_document' => array(
|
|
'columns' => array('documentPHID', 'version'),
|
|
'unique' => true,
|
|
),
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function generatePHID() {
|
|
return PhabricatorPHID::generateNewPHID(
|
|
PhabricatorPHIDConstants::PHID_TYPE_LEGB);
|
|
}
|
|
|
|
/* -( PhabricatorMarkupInterface )----------------------------------------- */
|
|
|
|
|
|
public function getMarkupFieldKey($field) {
|
|
$hash = PhabricatorHash::digest($this->getMarkupText($field));
|
|
return 'LEGB:'.$hash;
|
|
}
|
|
|
|
public function newMarkupEngine($field) {
|
|
return PhabricatorMarkupEngine::newMarkupEngine(array());
|
|
}
|
|
|
|
public function getMarkupText($field) {
|
|
switch ($field) {
|
|
case self::MARKUP_FIELD_TEXT:
|
|
$text = $this->getText();
|
|
break;
|
|
case self::MARKUP_FIELD_TITLE:
|
|
$text = $this->getTitle();
|
|
break;
|
|
default:
|
|
throw new Exception('Unknown field: '.$field);
|
|
break;
|
|
}
|
|
|
|
return $text;
|
|
}
|
|
|
|
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
|
require_celerity_resource('phabricator-remarkup-css');
|
|
return phutil_tag(
|
|
'div',
|
|
array(
|
|
'class' => 'phabricator-remarkup',
|
|
),
|
|
$output);
|
|
}
|
|
|
|
public function shouldUseMarkupCache($field) {
|
|
return (bool)$this->getID();
|
|
}
|
|
|
|
}
|