@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorRepositoryStatusMessage
4 extends PhabricatorRepositoryDAO {
5
6 const TYPE_INIT = 'init';
7 const TYPE_FETCH = 'fetch';
8 const TYPE_NEEDS_UPDATE = 'needs-update';
9
10 const CODE_ERROR = 'error';
11 const CODE_OKAY = 'okay';
12
13 protected $repositoryID;
14 protected $statusType;
15 protected $statusCode;
16 protected $parameters = array();
17 protected $epoch;
18 protected $messageCount;
19
20 protected function getConfiguration() {
21 return array(
22 self::CONFIG_TIMESTAMPS => false,
23 self::CONFIG_SERIALIZATION => array(
24 'parameters' => self::SERIALIZATION_JSON,
25 ),
26 self::CONFIG_COLUMN_SCHEMA => array(
27 'statusType' => 'text32',
28 'statusCode' => 'text32',
29 'messageCount' => 'uint32',
30 ),
31 self::CONFIG_KEY_SCHEMA => array(
32 'repositoryID' => array(
33 'columns' => array('repositoryID', 'statusType'),
34 'unique' => true,
35 ),
36 ),
37 ) + parent::getConfiguration();
38 }
39
40 public function getParameter($key, $default = null) {
41 return idx($this->parameters, $key, $default);
42 }
43
44 public function getStatusTypeName() {
45 $names = array(
46 self::TYPE_INIT => pht('Error While Initializing Repository'),
47 self::TYPE_FETCH => pht('Error While Fetching Changes'),
48 self::TYPE_NEEDS_UPDATE => pht('Repository Needs Update'),
49 );
50
51 $type = $this->getStatusType();
52 return idx($names, $type, $type);
53 }
54
55}