本文整理汇总了PHP中Log::Debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::Debug方法的具体用法?PHP Log::Debug怎么用?PHP Log::Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HandleSecureRequest
public function HandleSecureRequest(IRestServer $server, $requireAdminRole = false)
{
$sessionToken = $server->GetHeader(WebServiceHeaders::SESSION_TOKEN);
$userId = $server->GetHeader(WebServiceHeaders::USER_ID);
Log::Debug('Handling secure request. url=%s, userId=%s, sessionToken=%s', $_SERVER['REQUEST_URI'], $userId, $sessionToken);
if (empty($sessionToken) || empty($userId)) {
Log::Debug('Empty token or userId');
return false;
}
$session = $this->repository->LoadBySessionToken($sessionToken);
if ($session != null && $session->IsExpired()) {
Log::Debug('Session is expired');
$this->repository->Delete($session);
return false;
}
if ($session == null || $session->UserId != $userId) {
Log::Debug('Session token does not match user session token');
return false;
}
if ($requireAdminRole && !$session->IsAdmin) {
Log::Debug('Route is limited to application administrators and this user is not an admin');
return false;
}
$session->ExtendSession();
$this->repository->Update($session);
$server->SetSession($session);
Log::Debug('Secure request was authenticated');
return true;
}
示例2: UpdateTheme
public function UpdateTheme()
{
$logoFile = $this->page->GetLogoFile();
$cssFile = $this->page->GetCssFile();
if ($logoFile != null) {
Log::Debug('Replacing logo with ' . $logoFile->OriginalName());
$targets = glob(ROOT_DIR . 'Web/img/custom-logo.*');
foreach ($targets as $target) {
$removed = unlink($target);
if (!$removed) {
Log::Error('Could not remove existing logo. Ensure %s is writable.', $target);
}
}
$target = ROOT_DIR . 'Web/img/custom-logo.' . $logoFile->Extension();
$copied = copy($logoFile->TemporaryName(), $target);
if (!$copied) {
Log::Error('Could not replace logo with %s. Ensure %s is writable.', $logoFile->OriginalName(), $target);
}
}
if ($cssFile != null) {
Log::Debug('Replacing css file with ' . $cssFile->OriginalName());
$target = ROOT_DIR . 'Web/css/custom-style.css';
$copied = copy($cssFile->TemporaryName(), $target);
if (!$copied) {
Log::Error('Could not replace css with %s. Ensure %s is writable.', $cssFile->OriginalName(), $target);
}
}
}
示例3: Validate
public function Validate($reservationSeries)
{
if ($this->userSession->IsAdmin) {
Log::Debug('User is application admin. Skipping check. UserId=%s', $this->userSession->UserId);
return new ReservationRuleResult(true);
}
if ($this->userSession->IsGroupAdmin || $this->userSession->IsResourceAdmin || $this->userSession->IsScheduleAdmin) {
if ($this->userSession->IsGroupAdmin) {
$user = $this->userRepository->LoadById($this->userSession->UserId);
$reservationUser = $this->userRepository->LoadById($reservationSeries->UserId());
if ($user->IsAdminFor($reservationUser)) {
Log::Debug('User is admin for reservation user. Skipping check. UserId=%s', $this->userSession->UserId);
return new ReservationRuleResult(true);
}
}
if ($this->userSession->IsResourceAdmin || $this->userSession->IsScheduleAdmin) {
$user = $this->userRepository->LoadById($this->userSession->UserId);
$isResourceAdmin = true;
foreach ($reservationSeries->AllResources() as $resource) {
if (!$user->IsResourceAdminFor($resource)) {
$isResourceAdmin = false;
break;
}
}
if ($isResourceAdmin) {
Log::Debug('User is admin for all resources. Skipping check. UserId=%s', $this->userSession->UserId);
return new ReservationRuleResult(true);
}
}
}
return $this->rule->Validate($reservationSeries);
}
示例4: HandleInvitationAction
/**
* @param $invitationAction
* @return string|null
*/
private function HandleInvitationAction($invitationAction)
{
$referenceNumber = $this->page->GetInvitationReferenceNumber();
$userId = $this->page->GetUserId();
Log::Debug('Invitation action %s for user %s and reference number %s', $invitationAction, $userId, $referenceNumber);
$series = $this->reservationRepository->LoadByReferenceNumber($referenceNumber);
if ($invitationAction == InvitationAction::Accept) {
$series->AcceptInvitation($userId);
foreach ($series->AllResources() as $resource) {
if (!$resource->HasMaxParticipants()) {
continue;
}
/** @var $instance Reservation */
foreach ($series->Instances() as $instance) {
$numberOfParticipants = count($instance->Participants());
if ($numberOfParticipants > $resource->GetMaxParticipants()) {
return Resources::GetInstance()->GetString('MaxParticipantsError', array($resource->GetName(), $resource->GetMaxParticipants()));
}
}
}
}
if ($invitationAction == InvitationAction::Decline) {
$series->DeclineInvitation($userId);
}
if ($invitationAction == InvitationAction::CancelInstance) {
$series->CancelInstanceParticipation($userId);
}
if ($invitationAction == InvitationAction::CancelAll) {
$series->CancelAllParticipation($userId);
}
$this->reservationRepository->Update($series);
return null;
}
示例5: RemoveFile
/**
* @param $fullPath string
* @return void
*/
public function RemoveFile($fullPath)
{
Log::Debug('Deleting file: %s', $fullPath);
if (unlink($fullPath) === false) {
Log::Error('Could not delete file: %s', $fullPath);
}
}
示例6: __construct
/**
* @param associative array of SAML user attributes
* @param associated array of configuration options
*/
public function __construct($saml_attributes = array(), $options = array())
{
Log::Debug('Inside construct SamlUser');
if (count($options) > 0) {
Log::Debug('Inside construct SamlUser and count options is %d', count($options));
if (array_key_exists("ssphp_username", $options) && array_key_exists($options["ssphp_username"], $saml_attributes)) {
$this->username = $saml_attributes[$options["ssphp_username"]][0];
Log::Debug('Value of username is %s', $this->GetUserName());
}
if (array_key_exists("ssphp_firstname", $options) && array_key_exists($options["ssphp_firstname"], $saml_attributes)) {
$this->fname = $saml_attributes[$options["ssphp_firstname"]][0];
Log::Debug('Value of fname is %s', $this->GetFirstName());
}
if (array_key_exists("ssphp_lastname", $options) && array_key_exists($options["ssphp_lastname"], $saml_attributes)) {
$this->lname = $saml_attributes[$options["ssphp_lastname"]][0];
Log::Debug('Value of lname is %s', $this->GetLastName());
}
if (array_key_exists("ssphp_email", $options) && array_key_exists($options["ssphp_email"], $saml_attributes)) {
$this->mail = $saml_attributes[$options["ssphp_email"]][0];
}
if (array_key_exists("ssphp_phone", $options) && array_key_exists($options["ssphp_phone"], $saml_attributes)) {
$this->phone = $saml_attributes[$options["ssphp_phone"]][0];
Log::Debug('Value of phone is %s', $this->GetPhone());
}
if (array_key_exists("ssphp_organization", $options) && array_key_exists($options["ssphp_organization"], $saml_attributes)) {
$this->institution = $saml_attributes[$options["ssphp_organization"]][0];
Log::Debug('Value of institution is %s', $this->GetInstitution());
}
if (array_key_exists("ssphp_position", $options) && array_key_exists($options["ssphp_position"], $saml_attributes)) {
$this->title = $saml_attributes[$options["ssphp_position"]][0];
Log::Debug('Value of title is %s', $this->GetTitle());
}
}
}
示例7: TryPageLoad
private function TryPageLoad($currentUser)
{
$fileId = $this->page->GetFileId();
$referenceNumber = $this->page->GetReferenceNumber();
Log::Debug('Trying to load reservation attachment. FileId: %s, ReferenceNumber %s', $fileId, $referenceNumber);
$attachment = $this->reservationRepository->LoadReservationAttachment($fileId);
if ($attachment == null) {
Log::Error('Error loading resource attachment, attachment not found');
return false;
}
$reservation = $this->reservationRepository->LoadByReferenceNumber($referenceNumber);
if ($reservation == null) {
Log::Error('Error loading resource attachment, reservation not found');
return false;
}
if ($reservation->SeriesId() != $attachment->SeriesId()) {
Log::Error('Error loading resource attachment, attachment not associated with reservation');
return false;
}
if (!$this->permissionService->CanAccessResource(new ReservationResource($reservation->ResourceId()), $currentUser)) {
Log::Error('Error loading resource attachment, insufficient permissions');
return false;
}
return $attachment;
}
示例8: Logout
public function Logout(UserSession $user)
{
Log::Debug('Attempting CAS logout for email: %s', $user->Email);
$this->authToDecorate->Logout($user);
if ($this->options->CasHandlesLogouts()) {
phpCAS::logout();
}
}
示例9: GetResults
private function GetResults($type, $term)
{
if (array_key_exists($type, $this->listMethods)) {
$method = $this->listMethods[$type];
return $this->{$method}($term);
}
Log::Debug("AutoComplete for type: {$type} not defined");
return '';
}
示例10: showSecurimage
private function showSecurimage()
{
Log::Debug('CaptchaControl using Securimage');
$url = CaptchaService::Create()->GetImageUrl();
$label = Resources::GetInstance()->GetString('SecurityCode');
$formName = FormKeys::CAPTCHA;
echo "<img src='{$url}' alt='captcha' id='captchaImg'/>";
echo "<br/><label class=\"reg\">{$label}<br/><input type=\"text\" class=\"input\" name=\"{$formName}\" size=\"20\" id=\"captchaValue\"/>";
}
示例11: SignOut
/**
* @name SignOut
* @request SignOutRequest
* @return void
*/
public function SignOut()
{
/** @var $request SignOutRequest */
$request = $this->server->GetRequest();
$userId = $request->userId;
$sessionToken = $request->sessionToken;
Log::Debug('WebService SignOut for userId %s and sessionToken %s', $userId, $sessionToken);
$this->authentication->Logout($userId, $sessionToken);
}
示例12: Send
/**
* @param IEmailMessage $emailMessage
*/
function Send(IEmailMessage $emailMessage)
{
if (is_array($emailMessage->To())) {
$to = implode(', ', $emailMessage->To());
} else {
$to = $emailMessage->To();
}
Log::Debug("Sending Email. To: %s\nFrom: %s\nSubject: %s\nBody: %s", $to, $emailMessage->From(), $emailMessage->Subject(), $emailMessage->Body());
}
示例13: Notify
/**
* @param ReservationSeries $reservation
* @return void
*/
public function Notify($reservation)
{
$owner = $this->_userRepo->LoadById($reservation->UserId());
if ($this->ShouldSend($owner)) {
$message = $this->GetMessage($owner, $reservation, $this->_attributeRepo);
ServiceLocator::GetEmailService()->Send($message);
} else {
Log::Debug('Owner does not want these types of email notifications. Email=%s, ReferenceNumber=%s', $owner->EmailAddress(), $reservation->CurrentInstance()->ReferenceNumber());
}
}
示例14: PageLoad
public function PageLoad()
{
$referenceNumber = $this->page->GetReferenceNumber();
Log::Debug('User: %s, Approving reservation with reference number %s', $this->userSession->UserId, $referenceNumber);
$series = $this->persistenceService->LoadByReferenceNumber($referenceNumber);
if ($this->authorization->CanApprove(new ReservationViewAdapter($series), $this->userSession)) {
$series->Approve($this->userSession);
$this->handler->Handle($series, $this->page);
}
}
示例15: Validate
public function Validate()
{
if ($this->file == null) {
return;
}
$this->isValid = !$this->file->IsError();
if (!$this->IsValid()) {
Log::Debug('Uploaded file %s is not valid. %s', $this->file->OriginalName(), $this->file->Error());
$this->AddMessage($this->file->Error());
}
}