Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F118118551
NuanceItemUpdateWorker.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
Tue, Jun 17, 20:23
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jun 19, 20:23 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26843433
Attached To
rPH Phabricator
NuanceItemUpdateWorker.php
View Options
<?php
final
class
NuanceItemUpdateWorker
extends
NuanceWorker
{
protected
function
doWork
()
{
$item_phid
=
$this
->
getTaskDataValue
(
'itemPHID'
);
$hash
=
PhabricatorHash
::
digestForIndex
(
$item_phid
);
$lock_key
=
"nuance.item.{$hash}"
;
$lock
=
PhabricatorGlobalLock
::
newLock
(
$lock_key
);
$lock
->
lock
(
1
);
try
{
$item
=
$this
->
loadItem
(
$item_phid
);
$this
->
updateItem
(
$item
);
$this
->
routeItem
(
$item
);
}
catch
(
Exception
$ex
)
{
$lock
->
unlock
();
throw
$ex
;
}
$lock
->
unlock
();
}
private
function
updateItem
(
NuanceItem
$item
)
{
$impl
=
$item
->
getImplementation
();
if
(
$impl
->
canUpdateItems
())
{
$impl
->
updateItem
(
$item
);
}
}
private
function
routeItem
(
NuanceItem
$item
)
{
$status
=
$item
->
getStatus
();
if
(
$status
!=
NuanceItem
::
STATUS_ROUTING
)
{
return
;
}
$source
=
$item
->
getSource
();
// For now, always route items into the source's default queue.
$item
->
setQueuePHID
(
$source
->
getDefaultQueuePHID
())
->
setStatus
(
NuanceItem
::
STATUS_OPEN
)
->
save
();
}
}
Event Timeline
Log In to Comment