[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorFeedStoryNotification extends PhabricatorFeedDAO { 4 5 protected $userPHID; 6 protected $primaryObjectPHID; 7 protected $chronologicalKey; 8 protected $hasViewed; 9 10 public function getConfiguration() { 11 return array( 12 self::CONFIG_IDS => self::IDS_MANUAL, 13 self::CONFIG_TIMESTAMPS => false, 14 self::CONFIG_COLUMN_SCHEMA => array( 15 'chronologicalKey' => 'uint64', 16 'hasViewed' => 'bool', 17 'id' => null, 18 ), 19 self::CONFIG_KEY_SCHEMA => array( 20 'PRIMARY' => null, 21 'userPHID' => array( 22 'columns' => array('userPHID', 'chronologicalKey'), 23 'unique' => true, 24 ), 25 'userPHID_2' => array( 26 'columns' => array('userPHID', 'hasViewed', 'primaryObjectPHID'), 27 ), 28 ), 29 ) + parent::getConfiguration(); 30 } 31 32 static public function updateObjectNotificationViews( 33 PhabricatorUser $user, 34 $object_phid) { 35 36 $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); 37 38 $notification_table = new PhabricatorFeedStoryNotification(); 39 $conn = $notification_table->establishConnection('w'); 40 41 queryfx( 42 $conn, 43 'UPDATE %T 44 SET hasViewed = 1 45 WHERE userPHID = %s 46 AND primaryObjectPHID = %s 47 AND hasViewed = 0', 48 $notification_table->getTableName(), 49 $user->getPHID(), 50 $object_phid); 51 52 unset($unguarded); 53 } 54 55 public function countUnread(PhabricatorUser $user) { 56 $conn = $this->establishConnection('r'); 57 58 $data = queryfx_one( 59 $conn, 60 'SELECT COUNT(*) as count 61 FROM %T 62 WHERE userPHID = %s AND hasViewed = 0', 63 $this->getTableName(), 64 $user->getPHID()); 65 66 return $data['count']; 67 } 68 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |