Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/management/PhabricatorStoragePatch.php
<?php | <?php | ||||
final class PhabricatorStoragePatch extends Phobject { | final class PhabricatorStoragePatch extends Phobject { | ||||
private $key; | private $key; | ||||
private $fullKey; | private $fullKey; | ||||
private $name; | private $name; | ||||
private $type; | private $type; | ||||
private $after; | private $after; | ||||
private $legacy; | private $legacy; | ||||
private $dead; | private $dead; | ||||
private $phase; | |||||
const PHASE_DEFAULT = 'default'; | |||||
const PHASE_WORKER = 'worker'; | |||||
public function __construct(array $dict) { | public function __construct(array $dict) { | ||||
$this->key = $dict['key']; | $this->key = $dict['key']; | ||||
$this->type = $dict['type']; | $this->type = $dict['type']; | ||||
$this->fullKey = $dict['fullKey']; | $this->fullKey = $dict['fullKey']; | ||||
$this->legacy = $dict['legacy']; | $this->legacy = $dict['legacy']; | ||||
$this->name = $dict['name']; | $this->name = $dict['name']; | ||||
$this->after = $dict['after']; | $this->after = $dict['after']; | ||||
$this->dead = $dict['dead']; | $this->dead = $dict['dead']; | ||||
$this->phase = $dict['phase']; | |||||
} | } | ||||
public function getLegacy() { | public function getLegacy() { | ||||
return $this->legacy; | return $this->legacy; | ||||
} | } | ||||
public function getAfter() { | public function getAfter() { | ||||
return $this->after; | return $this->after; | ||||
Show All 10 Lines | final class PhabricatorStoragePatch extends Phobject { | ||||
public function getFullKey() { | public function getFullKey() { | ||||
return $this->fullKey; | return $this->fullKey; | ||||
} | } | ||||
public function getKey() { | public function getKey() { | ||||
return $this->key; | return $this->key; | ||||
} | } | ||||
public function getPhase() { | |||||
return $this->phase; | |||||
} | |||||
public function isDead() { | public function isDead() { | ||||
return $this->dead; | return $this->dead; | ||||
} | } | ||||
public function getIsGlobalPatch() { | public function getIsGlobalPatch() { | ||||
return ($this->getType() == 'php'); | return ($this->getType() == 'php'); | ||||
} | } | ||||
public static function getPhaseList() { | |||||
return array_keys(self::getPhaseMap()); | |||||
} | |||||
public static function getDefaultPhase() { | |||||
return self::PHASE_DEFAULT; | |||||
} | |||||
private static function getPhaseMap() { | |||||
return array( | |||||
self::PHASE_DEFAULT => array( | |||||
'order' => 0, | |||||
), | |||||
self::PHASE_WORKER => array( | |||||
'order' => 1, | |||||
), | |||||
); | |||||
} | |||||
public function newSortVector() { | |||||
$map = self::getPhaseMap(); | |||||
$phase = $this->getPhase(); | |||||
return id(new PhutilSortVector()) | |||||
->addInt($map[$phase]['order']); | |||||
} | |||||
} | } |