Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/query/PhabricatorPeopleLogSearchEngine.php
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | if ($map['createdStart'] || $map['createdEnd']) { | ||||
| $map['createdStart'], | $map['createdStart'], | ||||
| $map['createdEnd']); | $map['createdEnd']); | ||||
| } | } | ||||
| return $query; | return $query; | ||||
| } | } | ||||
| protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
| $types = PhabricatorUserLogType::getAllLogTypes(); | |||||
| $types = mpull($types, 'getLogTypeName', 'getLogTypeKey'); | |||||
| return array( | return array( | ||||
| id(new PhabricatorUsersSearchField()) | id(new PhabricatorUsersSearchField()) | ||||
| ->setKey('userPHIDs') | ->setKey('userPHIDs') | ||||
| ->setAliases(array('users', 'user', 'userPHID')) | ->setAliases(array('users', 'user', 'userPHID')) | ||||
| ->setLabel(pht('Users')) | ->setLabel(pht('Users')) | ||||
| ->setDescription(pht('Search for activity affecting specific users.')), | ->setDescription(pht('Search for activity affecting specific users.')), | ||||
| id(new PhabricatorUsersSearchField()) | id(new PhabricatorUsersSearchField()) | ||||
| ->setKey('actorPHIDs') | ->setKey('actorPHIDs') | ||||
| ->setAliases(array('actors', 'actor', 'actorPHID')) | ->setAliases(array('actors', 'actor', 'actorPHID')) | ||||
| ->setLabel(pht('Actors')) | ->setLabel(pht('Actors')) | ||||
| ->setDescription(pht('Search for activity by specific users.')), | ->setDescription(pht('Search for activity by specific users.')), | ||||
| id(new PhabricatorSearchCheckboxesField()) | id(new PhabricatorSearchCheckboxesField()) | ||||
| ->setKey('actions') | ->setKey('actions') | ||||
| ->setLabel(pht('Actions')) | ->setLabel(pht('Actions')) | ||||
| ->setDescription(pht('Search for particular types of activity.')) | ->setDescription(pht('Search for particular types of activity.')) | ||||
| ->setOptions(PhabricatorUserLog::getActionTypeMap()), | ->setOptions($types), | ||||
| id(new PhabricatorSearchTextField()) | id(new PhabricatorSearchTextField()) | ||||
| ->setKey('ip') | ->setKey('ip') | ||||
| ->setLabel(pht('Filter IP')) | ->setLabel(pht('Filter IP')) | ||||
| ->setDescription(pht('Search for actions by remote address.')), | ->setDescription(pht('Search for actions by remote address.')), | ||||
| id(new PhabricatorSearchStringListField()) | id(new PhabricatorSearchStringListField()) | ||||
| ->setKey('sessions') | ->setKey('sessions') | ||||
| ->setLabel(pht('Sessions')) | ->setLabel(pht('Sessions')) | ||||
| ->setDescription(pht('Search for activity in particular sessions.')), | ->setDescription(pht('Search for activity in particular sessions.')), | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | protected function newExportData(array $logs) { | ||||
| $phids = array(); | $phids = array(); | ||||
| foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
| $phids[] = $log->getUserPHID(); | $phids[] = $log->getUserPHID(); | ||||
| $phids[] = $log->getActorPHID(); | $phids[] = $log->getActorPHID(); | ||||
| } | } | ||||
| $handles = $viewer->loadHandles($phids); | $handles = $viewer->loadHandles($phids); | ||||
| $action_map = PhabricatorUserLog::getActionTypeMap(); | $types = PhabricatorUserLogType::getAllLogTypes(); | ||||
| $types = mpull($types, 'getLogTypeName', 'getLogTypeKey'); | |||||
| $export = array(); | $export = array(); | ||||
| foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
| $user_phid = $log->getUserPHID(); | $user_phid = $log->getUserPHID(); | ||||
| if ($user_phid) { | if ($user_phid) { | ||||
| $user_name = $handles[$user_phid]->getName(); | $user_name = $handles[$user_phid]->getName(); | ||||
| } else { | } else { | ||||
| $user_name = null; | $user_name = null; | ||||
| } | } | ||||
| $actor_phid = $log->getActorPHID(); | $actor_phid = $log->getActorPHID(); | ||||
| if ($actor_phid) { | if ($actor_phid) { | ||||
| $actor_name = $handles[$actor_phid]->getName(); | $actor_name = $handles[$actor_phid]->getName(); | ||||
| } else { | } else { | ||||
| $actor_name = null; | $actor_name = null; | ||||
| } | } | ||||
| $action = $log->getAction(); | $action = $log->getAction(); | ||||
| $action_name = idx($action_map, $action, pht('Unknown ("%s")', $action)); | $action_name = idx($types, $action, pht('Unknown ("%s")', $action)); | ||||
| $map = array( | $map = array( | ||||
| 'actorPHID' => $actor_phid, | 'actorPHID' => $actor_phid, | ||||
| 'actor' => $actor_name, | 'actor' => $actor_name, | ||||
| 'userPHID' => $user_phid, | 'userPHID' => $user_phid, | ||||
| 'user' => $user_name, | 'user' => $user_name, | ||||
| 'action' => $action, | 'action' => $action, | ||||
| 'actionName' => $action_name, | 'actionName' => $action_name, | ||||
| Show All 16 Lines | |||||