3 final class PhabricatorRepositoryFilesizeLimitTransaction
4 extends PhabricatorRepositoryTransactionType
{
6 const TRANSACTIONTYPE
= 'limit.filesize';
8 public function generateOldValue($object) {
9 return $object->getFilesizeLimit();
12 public function generateNewValue($object, $value) {
13 if (!strlen($value)) {
17 $value = phutil_parse_bytes($value);
25 public function applyInternalEffects($object, $value) {
26 $object->setFilesizeLimit($value);
29 public function getTitle() {
30 $old = $this->getOldValue();
31 $new = $this->getNewValue();
35 '%s changed the filesize limit for this repository from %s bytes to '.
37 $this->renderAuthor(),
38 $this->renderOldValue(),
39 $this->renderNewValue());
42 '%s set the filesize limit for this repository to %s bytes.',
43 $this->renderAuthor(),
44 $this->renderNewValue());
47 '%s removed the filesize limit (%s bytes) for this repository.',
48 $this->renderAuthor(),
49 $this->renderOldValue());
53 public function validateTransactions($object, array $xactions) {
56 foreach ($xactions as $xaction) {
57 $new = $xaction->getNewValue();
64 $value = phutil_parse_bytes($new);
65 } catch (Exception
$ex) {
66 $errors[] = $this->newInvalidError(
68 'Unable to parse filesize limit: %s',