3 final class PhameBlogParentDomainTransaction
4 extends PhameBlogTransactionType
{
6 const TRANSACTIONTYPE
= 'phame.blog.parent.domain';
8 public function generateOldValue($object) {
9 return $object->getParentDomain();
12 public function applyInternalEffects($object, $value) {
13 $object->setParentDomain($value);
16 public function getTitle() {
17 $old = $this->getOldValue();
20 '%s set this blog\'s parent domain to %s.',
21 $this->renderAuthor(),
22 $this->renderNewValue());
25 '%s updated the blog\'s parent domain from %s to %s.',
26 $this->renderAuthor(),
27 $this->renderOldValue(),
28 $this->renderNewValue());
32 public function getTitleForFeed() {
33 $old = $this->getOldValue();
36 '%s set %s blog\'s parent domain to %s.',
37 $this->renderAuthor(),
38 $this->renderObject(),
39 $this->renderNewValue());
42 '%s updated %s blog\'s parent domain from %s to %s.',
43 $this->renderAuthor(),
44 $this->renderObject(),
45 $this->renderOldValue(),
46 $this->renderNewValue());
50 public function validateTransactions($object, array $xactions) {
57 $parent_domain = last($xactions)->getNewValue();
58 if (empty($parent_domain)) {
63 PhabricatorEnv
::requireValidRemoteURIForLink($parent_domain);
64 } catch (Exception
$ex) {
65 $errors[] = $this->newInvalidError(
66 pht('Parent Domain must be set to a valid Remote URI.'));
69 $max_length = $object->getColumnMaximumByteLength('parentDomain');
70 foreach ($xactions as $xaction) {
71 $new_value = $xaction->getNewValue();
72 $new_length = strlen($new_value);
73 if ($new_length > $max_length) {
74 $errors[] = $this->newInvalidError(
75 pht('The parent domain can be no longer than %s characters.',
76 new PhutilNumber($max_length)));