Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894180
PhabricatorUserNotificationCountCacheType.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1012 B
Referenced Files
None
Subscribers
None
PhabricatorUserNotificationCountCacheType.php
View Options
<?php
final
class
PhabricatorUserNotificationCountCacheType
extends
PhabricatorUserCacheType
{
const
CACHETYPE
=
'notification.count'
;
const
KEY_COUNT
=
'user.notification.count.v1'
;
public
function
getAutoloadKeys
(
)
{
return
array
(
self
::
KEY_COUNT
,
)
;
}
public
function
canManageKey
(
$key
)
{
return
(
$key
===
self
::
KEY_COUNT
)
;
}
public
function
getValueFromStorage
(
$value
)
{
return
(int)
$value
;
}
public
function
newValueForUsers
(
$key
,
array
$users
)
{
if
(
!
$users
)
{
return
array
(
)
;
}
$user_phids
=
mpull
(
$users
,
'getPHID'
)
;
$table
=
new
PhabricatorFeedStoryNotification
(
)
;
$conn_r
=
$table
->
establishConnection
(
'r'
)
;
$rows
=
queryfx_all
(
$conn_r
,
'SELECT userPHID, COUNT(*) N FROM %T
WHERE userPHID IN (%Ls) AND hasViewed = 0
GROUP BY userPHID'
,
$table
->
getTableName
(
)
,
$user_phids
)
;
$empty
=
array_fill_keys
(
$user_phids
,
0
)
;
return
ipull
(
$rows
,
'N'
,
'userPHID'
)
+
$empty
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:31 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127998
Default Alt Text
PhabricatorUserNotificationCountCacheType.php (1012 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment