Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96534538
PhabricatorRepositoryServiceTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Dec 27, 17:57
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 29, 17:57 (1 d, 7 h)
Engine
blob
Format
Raw Data
Handle
23200697
Attached To
rPH Phabricator
PhabricatorRepositoryServiceTransaction.php
View Options
<?php
final
class
PhabricatorRepositoryServiceTransaction
extends
PhabricatorRepositoryTransactionType
{
const
TRANSACTIONTYPE
=
'repo:service'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getAlmanacServicePHID
();
}
public
function
generateNewValue
(
$object
,
$value
)
{
if
(
strlen
(
$value
))
{
return
$value
;
}
return
null
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setAlmanacServicePHID
(
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getOldValue
();
if
(
strlen
(
$old
)
&&
!
strlen
(
$new
))
{
return
pht
(
'%s moved storage for this repository from %s to local.'
,
$this
->
renderAuthor
(),
$this
->
renderOldHandle
());
}
else
if
(!
strlen
(
$old
)
&&
strlen
(
$new
))
{
// TODO: Possibly, we should distinguish between automatic assignment
// on creation vs explicit adjustment.
return
pht
(
'%s set storage for this repository to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderNewHandle
());
}
else
{
return
pht
(
'%s moved storage for this repository from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldHandle
(),
$this
->
renderNewHandle
());
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
// TODO: This could use some validation, values should be valid Almanac
// services of appropriate types. It's only reachable via the CLI so it's
// difficult to get wrong in practice.
return
$errors
;
}
}
Event Timeline
Log In to Comment