Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F474762
HarbormasterPlanDisableController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
HarbormasterPlanDisableController.php
View Options
<?php
final
class
HarbormasterPlanDisableController
extends
HarbormasterPlanController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$plan
=
id
(
new
HarbormasterBuildPlanQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$plan
)
{
return
new
Aphront404Response
();
}
$plan_uri
=
$this
->
getApplicationURI
(
'plan/'
.
$plan
->
getID
().
'/'
);
if
(
$request
->
isFormPost
())
{
$type_status
=
HarbormasterBuildPlanTransaction
::
TYPE_STATUS
;
$v_status
=
$plan
->
isDisabled
()
?
HarbormasterBuildPlan
::
STATUS_ACTIVE
:
HarbormasterBuildPlan
::
STATUS_DISABLED
;
$xactions
=
array
();
$xactions
[]
=
id
(
new
HarbormasterBuildPlanTransaction
())
->
setTransactionType
(
$type_status
)
->
setNewValue
(
$v_status
);
$editor
=
id
(
new
HarbormasterBuildPlanEditor
())
->
setActor
(
$viewer
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
setContentSourceFromRequest
(
$request
);
$editor
->
applyTransactions
(
$plan
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$plan_uri
);
}
if
(
$plan
->
isDisabled
())
{
$title
=
pht
(
'Enable Build Plan'
);
$body
=
pht
(
'Enable this build plan?'
);
$button
=
pht
(
'Enable Plan'
);
}
else
{
$title
=
pht
(
'Disable Build Plan'
);
$body
=
pht
(
'Disable this build plan? It will no longer be executed '
.
'automatically.'
);
$button
=
pht
(
'Disable Plan'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendChild
(
$body
)
->
addSubmitButton
(
$button
)
->
addCancelButton
(
$plan_uri
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 6, 9:25 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
84849
Default Alt Text
HarbormasterPlanDisableController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment