Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96534850
PhabricatorRepositoryCopyTimeLimitTransaction.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, 18:06
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 29, 18:06 (1 d, 8 h)
Engine
blob
Format
Raw Data
Handle
23200939
Attached To
rPH Phabricator
PhabricatorRepositoryCopyTimeLimitTransaction.php
View Options
<?php
final
class
PhabricatorRepositoryCopyTimeLimitTransaction
extends
PhabricatorRepositoryTransactionType
{
const
TRANSACTIONTYPE
=
'limit.copy'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getCopyTimeLimit
();
}
public
function
generateNewValue
(
$object
,
$value
)
{
if
(!
strlen
(
$value
))
{
return
null
;
}
$value
=
(
int
)
$value
;
if
(!
$value
)
{
return
null
;
}
return
$value
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setCopyTimeLimit
(
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
if
(
$old
&&
$new
)
{
return
pht
(
'%s changed the copy time limit for this repository from %s seconds '
.
'to %s seconds.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
else
if
(
$new
)
{
return
pht
(
'%s set the copy time limit for this repository to %s seconds.'
,
$this
->
renderAuthor
(),
$this
->
renderNewValue
());
}
else
{
return
pht
(
'%s reset the copy time limit (%s seconds) for this repository '
.
'to the default value.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
());
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
foreach
(
$xactions
as
$xaction
)
{
$new
=
$xaction
->
getNewValue
();
if
(!
strlen
(
$new
))
{
continue
;
}
if
(!
preg_match
(
'/^
\d
+
\z
/'
,
$new
))
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Unable to parse copy time limit, specify a positive number '
.
'of seconds.'
),
$xaction
);
continue
;
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment