public static function newLog(PhabricatorUser $actor = null, PhabricatorUser $user = null, $action) { $log = new PhabricatorUserLog(); if ($actor) { $log->setActorPHID($actor->getPHID()); } if ($user) { $log->setUserPHID($user->getPHID()); } else { $log->setUserPHID(''); } if ($action) { $log->setAction($action); } return $log; }
public static function initializeNewLog(PhabricatorUser $actor = null, $object_phid = null, $action = null) { $log = new PhabricatorUserLog(); if ($actor) { $log->setActorPHID($actor->getPHID()); if ($actor->hasSession()) { $session = $actor->getSession(); // NOTE: This is a hash of the real session value, so it's safe to // store it directly in the logs. $log->setSession($session->getSessionKey()); } } $log->setUserPHID((string) $object_phid); $log->setAction($action); $log->remoteAddr = (string) idx($_SERVER, 'REMOTE_ADDR', ''); return $log; }