Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F545191
PhabricatorPasteArchiveController.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
PhabricatorPasteArchiveController.php
View Options
<?php
final
class
PhabricatorPasteArchiveController
extends
PhabricatorPasteController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$paste
=
id
(
new
PhabricatorPasteQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$paste
)
{
return
new
Aphront404Response
();
}
$view_uri
=
$paste
->
getURI
();
if
(
$request
->
isFormPost
())
{
if
(
$paste
->
isArchived
())
{
$new_status
=
PhabricatorPaste
::
STATUS_ACTIVE
;
}
else
{
$new_status
=
PhabricatorPaste
::
STATUS_ARCHIVED
;
}
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorPasteTransaction
())
->
setTransactionType
(
PhabricatorPasteStatusTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$new_status
);
id
(
new
PhabricatorPasteEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$paste
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$view_uri
);
}
if
(
$paste
->
isArchived
())
{
$title
=
pht
(
'Activate Paste'
);
$body
=
pht
(
'This paste will become consumable again.'
);
$button
=
pht
(
'Activate Paste'
);
}
else
{
$title
=
pht
(
'Archive Paste'
);
$body
=
pht
(
'This paste will be marked as expired.'
);
$button
=
pht
(
'Archive Paste'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendChild
(
$body
)
->
addCancelButton
(
$view_uri
)
->
addSubmitButton
(
$button
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 12:41 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
107629
Default Alt Text
PhabricatorPasteArchiveController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment