Path: blob/master/src/applications/harbormaster/xaction/build/HarbormasterBuildMessageResumeTransaction.php
12264 views
<?php12final class HarbormasterBuildMessageResumeTransaction3extends HarbormasterBuildMessageTransaction {45const TRANSACTIONTYPE = 'message/resume';6const MESSAGETYPE = 'resume';78public function getHarbormasterBuildMessageName() {9return pht('Resume Build');10}1112public function getHarbormasterBuildableMessageName() {13return pht('Resume Builds');14}1516public function getHarbormasterBuildableMessageEffect() {17return pht('Build will resume.');18}1920public function newConfirmPromptTitle() {21return pht('Really resume build?');22}2324public function newConfirmPromptBody() {25return pht(26'Work will continue on the build. Really resume?');27}2829public function getHarbormasterBuildMessageDescription() {30return pht('Resume work on a previously paused build.');31}3233public function newBuildableConfirmPromptTitle(34array $builds,35array $sendable) {36return pht(37'Really resume %s build(s)?',38phutil_count($builds));39}4041public function newBuildableConfirmPromptBody(42array $builds,43array $sendable) {4445if (count($sendable) === count($builds)) {46return pht(47'Work will continue on all builds. Really resume?');48} else {49return pht(50'You can only resume some builds. Work will continue on builds '.51'you have permission to resume.');52}53}5455public function getTitle() {56return pht(57'%s resumed this build.',58$this->renderAuthor());59}6061public function getIcon() {62return 'fa-play';63}6465public function applyInternalEffects($object, $value) {66$actor = $this->getActor();67$build = $object;6869$build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING);70}7172protected function newCanApplyMessageAssertion(73PhabricatorUser $viewer,74HarbormasterBuild $build) {7576if ($build->isAutobuild()) {77throw new HarbormasterMessageException(78pht('Unable to Resume Build'),79pht(80'You can not resume a build that uses an autoplan.'));81}8283if (!$build->isPaused() && !$build->isPausing()) {84throw new HarbormasterMessageException(85pht('Unable to Resume Build'),86pht(87'You can not resume this build because it is not paused. You can '.88'only resume a paused build.'));89}9091}9293protected function newCanSendMessageAssertion(94PhabricatorUser $viewer,95HarbormasterBuild $build) {9697if ($build->isResuming()) {98throw new HarbormasterMessageException(99pht('Unable to Resume Build'),100pht(101'You can not resume this build beacuse it is already resuming.'));102}103104if ($build->isRestarting()) {105throw new HarbormasterMessageException(106pht('Unable to Resume Build'),107pht('You can not resume this build because it is already restarting.'));108}109110if ($build->isAborting()) {111throw new HarbormasterMessageException(112pht('Unable to Resume Build'),113pht('You can not resume this build because it is already aborting.'));114}115116}117118}119120121